Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 14-03-06
lakrasia's Avatar
Dot Com Pennyaire
 
Join Date: Jan 2004
Location: this month, Guatemala
Posts: 626
Thanks: 0
Thanked 0 Times in 0 Posts
lakrasia is an unknown quantity at this point
  cron jobs and php

Hi,

I have a php page to process mysql records which works fine. Except when I run it as a cron job, using 'wget' - the main part doesn't work - it does run, as I've written it to send me an e-mail at the end, which it does.

I'm puzzled. It requires no interaction, needless to say, so it's not falling over because I haven't filled in a form.

I don't really want to show the code here, but I wondered if there's anything in general that cron jobs can't handle please?

Cheers
Linda
__________________
I used to have an open mind but my brains kept falling out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 14-03-06
pricethat's Avatar
data muncher
 
Join Date: Sep 2004
Location: Berlin
Posts: 2,485
Thanks: 0
Thanked 0 Times in 0 Posts
pricethat is an unknown quantity at this point
awww goo on, lets have a laugh at it

You would be better off showing the code, its like a guessing game otherwise. I know people can be protective of their code like its some majic secret but i am sure its nothing that hasnt either been done before or done better (as in works with cron tasks).
__________________
Nothing to see here...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 14-03-06
OLBG's Avatar
aka Antony
 
Join Date: Mar 2005
Location: Bristol
Posts: 528
Thanks: 0
Thanked 0 Times in 0 Posts
OLBG is an unknown quantity at this point
I think there is a difference on how a page runs when under a cron than when run by a browser. Can affect file paths etc - does your script have any includes?
__________________
Antony
Free Tipster Competition
Affiliate Program on POR - up to £2/lead
Grand National Guide
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 14-03-06
Swiss's Avatar
memoryfinder.co.uk
 
Join Date: Jun 2005
Location: Wiltshire, UK
Posts: 343
Thanks: 0
Thanked 0 Times in 0 Posts
Swiss is an unknown quantity at this point
Doesn't wget actually download the taget file instead of executing it? Whats the actual crontab command that you are using?
__________________
Kris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 14-03-06
lakrasia's Avatar
Dot Com Pennyaire
 
Join Date: Jan 2004
Location: this month, Guatemala
Posts: 626
Thanks: 0
Thanked 0 Times in 0 Posts
lakrasia is an unknown quantity at this point
Hi,

Thanks - I removed the include, but it didn't help.

I spent ages doing tests and narrowed it down to a single line of code.

[php]$datafeedurl="http://products.affiliatewindow.com/csvproductoutput.php?mid=".$merchantid."&user=1234 5&password=password&nozip=1";
PHP]

I'm sending two variables to the script. One definitely works, but somewhere $merchantid is getting lost.

Very strange that it works manually, but not as a cron job and I really need to figure this out, if anyone knows why.

Cheers
Linda
__________________
I used to have an open mind but my brains kept falling out.

Last edited by lakrasia; 14-03-06 at 05:38 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 14-03-06
Super Moderator
 
Join Date: Aug 2003
Posts: 2,451
Thanks: 0
Thanked 0 Times in 0 Posts
Rich is an unknown quantity at this point
There should be no difference between a wget request and a manual one to the same url, but as it sounds like you have variables in the request it could be those that are confising things, particually if there are more than one.

If you're currently trying to run: -
wget http://www.yoursite.com/script.php?s...6&merchantid=5

then you'll want to change it to: -
wget "http://www.yoursite.com/script.php?something=6&merchantid=5"

otherwise the & will get treated as the end of the command.

That doesn't really explain why you can email $merchantid to yourself but that it isn't getting included in the datafeedurl.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 14-03-06
lakrasia's Avatar
Dot Com Pennyaire
 
Join Date: Jan 2004
Location: this month, Guatemala
Posts: 626
Thanks: 0
Thanked 0 Times in 0 Posts
lakrasia is an unknown quantity at this point
Thanks so much Rich.

Firstly, I think I got muddled about the e-mail getting the variable - I've been running cron jobs all day, interspersed with manual ones to fix the file after. Half the time the cron jobs don't run, so it's been a very confusing task.

BTW - ' works, " wipes out the job completely.

Thanks very much - really pleased to finally get it running.

Cheers
Linda
__________________
I used to have an open mind but my brains kept falling out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 16-03-06
marcg's Avatar
Registered User
 
Join Date: Sep 2004
Location: Loughton, Essex
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
marcg is an unknown quantity at this point
Quote:
Originally Posted by lakrasia
I have a php page to process mysql records which works fine. Except when I run it as a cron job, using 'wget' - the main part doesn't work - it does run, as I've written it to send me an e-mail at the end, which it does.
Why are you running wget through cron are you running the request on a remote machine?

Couldn't you just setup a cron job on the system the script is running on to execute it using the command line php interpreter?

/usr/bin/php /path/to/scriptname.php > output.txt

??

It sounds to me like your script requires some parameters passed to it in the querystring and these are not being sent by the wget command. you might need to look at the docs for wget, but it likes some qs chars to be escaped.
__________________
Marc Gear
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 16-03-06
lakrasia's Avatar
Dot Com Pennyaire
 
Join Date: Jan 2004
Location: this month, Guatemala
Posts: 626
Thanks: 0
Thanked 0 Times in 0 Posts
lakrasia is an unknown quantity at this point
Thanks Marc,

Rich solved the problem for me in his posting before I sent my posting thanking him. Maybe I didn't make it clear that it worked - it just needed the " changed to '.

Cheers
Linda
__________________
I used to have an open mind but my brains kept falling out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Jobs - how to do them without support scifind Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 23-01-04 07:33 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7