You are here:  » import.php via HTTP


import.php via HTTP

Submitted by redspark on Tue, 2010-09-21 12:51 in

Hi David,

Unfortunatly my provider doesnt support command lines in their cron jobs. Their suggestion is to use a script via http and then i could make a cronjob like
scripts/import.php?flag=modified

I have been looking in the forum for a solution.But i cant find any. Do you have a solution?

Regards,

B.

Submitted by support on Tue, 2010-09-21 12:57

Hi,

Sure - in scripts/import.php you will find this code beginning at line 13:

  $argc = $_SERVER["argc"];
  $argv = $_SERVER["argv"];

...simply REPLACE that with:

  if ($_GET["filename"])
  {
    $argc = 2;
    $argv[1] = $_GET["filename"];
    if ($_GET["limit"]) $argv[2] = $_GET["limit"];
  }
  else
  {
    $argc = $_SERVER["argc"];
    $argv = $_SERVER["argv"];
  }

You will then be able to request, for example,

/scripts/import.php?filename=@MODIFIED

Cheers,
David.
--
PriceTapestry.com

Submitted by redspark on Tue, 2010-09-21 13:52

That did the job!

Many thanks.

Submitted by redspark on Tue, 2010-09-28 07:46

Hi David,

I have automated all my downloads and imports now, accept for 2 feeds which are 2 big. I use the slow import tool to get them in the DB. I have read a post about using the slow import tool via a cronjob. Could you help me modify it for doing it via http?

regards,

B.

Submitted by support on Tue, 2010-09-28 08:07

Hi,

Sure - i'll email you the version of admin/feeds_import_slow.php that can be called via wget from the command line (or automation script)...

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Fri, 2011-03-11 13:26

Hi David
I too have 2 feeds that need to be slow imported. Could I have the script for this also please?

Submitted by support on Fri, 2011-03-11 13:34

Hi bat,

The scriptable slow import tool is in the latest distribution as scripts/import_slow.php, and will work fine with all previous distributions.

As the slow import method relies upon HTTP refresh to re-invoke the script for the next block, it needs to be called from within your automation script using wget rather than PHP. The command would normally be something like:

/usr/bin/wget -t 0 -O /dev/null "http://www.example.com/scripts/import_slow.php?filename=Filename.csv"

However, some earlier versions of wget require the --max-redirect parameter instead, so if the above aborts with an error "Maximum redirections exceeded", try the following instead:

/usr/bin/wget -max-redirect=9999 -O /dev/null "http://www.example.com/scripts/import_slow.php?filename=Filename.csv"

Cheers,
David.
--
PriceTapestry.com

Submitted by bat on Wed, 2015-09-23 08:33

Hi David,
There's no scripts/import_slow.php in the latest release of PT.
How do I do a cron job like in the post above please for slow import

Submitted by support on Wed, 2015-09-23 09:28

Hello bat,

I discontinued scripts/ version of import_slow.php as it can quite tricky to set-up however it is still in the 14/06A distribution and will work as above with the latest distribution.

Cheers,
David.
--
PriceTapestry.com