Results 1 to 4 of 4

Thread: special character at cron job

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Default special character at cron job

    Dear everybody,

    I am trying to set a cron job, the command is as below:

    wget http://www.XXX.com/abc.php?action=collect&siteid=1

    After the system run it, I found that bluehost can only read "http://www.XXX.com/abc.php?action=collect", but lost &siteid=1 part

    I also change the command as below, add "\" before the "&" character:

    wget http://www.XXX.com/abc.php?action=collect\&siteid=1

    After the modification, bluehost can read the "&" character, but output as below:

    http://www.XXX.com/abc.php?action=collect\&siteid=1

    Does anybody know how can I solve this problem?

    Thanks a lot!

  2. #2
    Join Date
    Oct 2009
    Posts
    2

    Default

    can anyone help me? Thanks!

  3. #3
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,951

    Default

    When the cron runs everything after the ? is iinaccessible anyway since jobs run from the command line have no access to $_GET

    What you need to do is to replace the ? and & with spaces and then read in the values from $_SERVER['argv']

  4. #4

    Default

    *nix servers (what bluehost runs) interprets the & character as an actual system command. To fix this, include your entire URL in double quotes:

    Code:
    wget "http://www.XXX.com/abc.php?action=collect&siteid=1"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •