Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 505827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:38:19+00:00 2026-05-13T06:38:19+00:00

I wrote a script to read the Netflix catalog and populate my DB. Everything

  • 0

I wrote a script to read the Netflix catalog and populate my DB. Everything worked fine as a web script (except for timeouts) so I shifted to calling directly from the console.

I noticed a few oddities, like __construct() no longer being called (but that was easily remedied using the class name as a function.

Now I can’t get my arrays to work as before, here’s the general idea.

(Actually I have tried a few combinations, so I’ll share them all)

1 – this worked in the web script version just fine, no longer works calling from console

//declare empty
var $genreArray=array();

//later I add values one at a time as the XML is parsed
array_push($this->genreArray,$attrs['term']);

//after I have parsed an entire "title" element, I iterate the array
foreach ($this->genreArray as $value) {
    // never gets called - array seen as empty
    $this->db->linkGenre($value,$this->title_uid);
}

2 – so I tried the PHP manual; recommendation – nothing

//declare empty
var $genreArray=array();

//later I add values one at a time as the XML is parsed
$this->genreArray[]=$attrs['term'];

//after I have parsed an entire "title" element, I iterate the array
foreach ($this->genreArray as $value) {
    // never gets called - array seen as empty
    $this->db->linkGenre($value,$this->title_uid);
}

3 – so finally I tried manually tracking the index

//declare empty array
var $genreArray=array();
var $gi=0;

//later I add values one at a time as the XML is parsed
$this->genreArray[$this->gi++]=$attrs['term'];

//after I have parsed an entire "title" element, I iterate the array
foreach ($this->genreArray as $value) {
    // never gets called - array seen as empty
    $this->db->linkGenre($value,$this->title_uid);
}

So I am totally stumped now.

Has anyone declared empty arrays and populated via console?

(All 3 of these work via the web – so I need a console expert here)


Thanks for the support, here are the additional details requested;

php -v

PHP 4.4.9 (cli) (built: Sep 17 2008 12:02:18)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies


Each snippet was tried in a separate run. What details about the class are you interested in?

I have used echo statements to verify that the code is being called as expected. And if I hit the script through a URL everything kicks off fine (for the first few thousand records until the timeout).


No errors are being thrown, I even tried adding…

error_reporting(E_ALL);
ini_set('display_errors', true);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:38:19+00:00Added an answer on May 13, 2026 at 6:38 am

    I noticed a few oddities, like __construct() no longer being called (but that was easily remidied using the class name as a function.

    It sounds like your command-line and web server PHP are different versions. Is your CLI PHP 4? The function phpversion() will tell you the version in both CLI and web.

    Have you checked your error log? You didn’t mention it, but that would be the first place to look.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i wrote a py script to fetch page from web,it just read write permission
I wrote this script to for a contact form on my website, everything works
I wrote a script to read a 100mb+ text file using a single thread
I wrote to functions in shell script to read and write variable settings from/to
I wrote this script which counts occurrences of particular pattern in a given file.
I wrote a script that uses xcodebuild to generate an AdHoc build of an
I recently wrote a script which queries PyPI and downloads a package; however, the
i have wrote a script to produce an array of data but now want
I have wrote a script to do some backup. There is a if block
to custom validate an input i wrote a script: function cardNumberCheck(value, element) { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.