Jump to content

Recommended Posts

Hey all, having a very odd problem this morning.

 

I have a cron job that executes a script that performs the following action:

 

"lynx --dump "php page""

 

This executes fine, I see all the output. The problem is this:

 

The php file is supposed to write information to a file. When executed by a user on a web browser like Chrome or Firefox, the data is written to the file with no problem. However with lynx the file is created with size 0, and no data is ever written.

 

Any ideas why this may be?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/253615-lynx-php-write-error/
Share on other sites

Hard to say without the actual cronjob setup or any code.

 

If the cron is something like:

 

lynx --dump "http://yoursite.com/phppage.php"

 

It should work, if it is not preceded with the http, that would be a problem. The other potential issue, is if the site is using session / cookies, lynx may be asking for permission for those cookies. You may be better off with wget or curl for the processing in that case.

 

How can I get the page to be processed without lynx?

 

Lynx was asking for permissions earlier for cookies, I told it to always accept. The code is a very simple:

 

$ourFileName = "export.csv";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fwrite($ourFileHandle, "all data");
fclose($ourFileHandle);

 

Cronjob setup is:

 

45 9 * * * lynx "site" > /opt/websites/wut.log

 

But Ive also tried using a visit.sh shell script that did the following:

 

lynx --dump "site"

 

Same result from both.

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.