Cron to run PHP script requiring a redirect

Discussion in 'PHP' started by Mayhem Design, Sep 13, 2007.

  1. #1
    Hi all,

    I'm trying to get a cron job to run a PHP script (the easy bit) that will send a header redirect to another script on another server.

    The script needs to redirect to header("Location:http://www.domain.com?info=xyz&info2=abc"); where domain.com is not located on my server. It works if I run the script through the browser, but Cron doesn't seem to make it all happen.

    Is there any way to be able to do this?

    Thanks.
     
    Mayhem Design, Sep 13, 2007 IP
  2. DopeDomains

    DopeDomains Guest

    Messages:
    207
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    DopeDomains, Sep 13, 2007 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Definitely cron and wget, and do it to the final page if possible.

    Also, you can get both cron and wget for windows, which in my experience is much better than task scheduler, if you are using a windows server.
     
    jestep, Sep 13, 2007 IP
  4. Mayhem Design

    Mayhem Design Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for that guys.

    The reason I need to get PHP to handle the redirect is that in my example URL http://www.domain.com?info=xyz&info2=abc, xyz and abc are being pulled out of a database, and the destination URL needs to be hit at a delayed time from when the user enters their info into the system.

    I had a look in the PHP manual at shell_exec and a few other functions but can't seem to get any of them to work with wget. Any further suggestions?

    Thanks again.
     
    Mayhem Design, Sep 13, 2007 IP
  5. Mayhem Design

    Mayhem Design Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just in addition, I'm running on a shared Linux server so I'm wondering if I don't have permission to run wget commands ... ? Are there any other options?

    Thanks.
     
    Mayhem Design, Sep 13, 2007 IP
  6. Mayhem Design

    Mayhem Design Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Mayhem Design, Sep 13, 2007 IP