0

I have some PHP I need to run using a Cron job however it requires a query string parameter which contains % characters for spaces and a / after URL encoding.

Eg. http://www.example.com/folder/do_something.php?param=Foo%20%2F%20Bar

This works perfectly when I manually run in the browser but not via Cron.

My command looks like this:

curl -u username:password -O "http://www.example.com/folder/do_something.php?param=Foo%20%2F%20Bar"

My cron jobs on this server without % are working and those with % are failing and the error message is:

Cron curl -u username:password -O http://www.example.com/folder/do_something.php?param=Foo (note how it cut the URL at the first % character).

/bin/sh: -c: line 0: unexpected EOF while looking for matching `"' /bin/sh: -c: line 1: syntax error: unexpected end of file

Basically it's not looking at the whole URL. It just stops at the first % character.

I have taken this up with the webhost however they are useless and have been unable to help.

I have also tried other commands such as wget -q -O - etc. and the same problem is happening for URLs with % regardless of the command approach.

Any ideas other than removing the % characters?

nicole2292
  • 111
  • 1
  • 9
  • Did you try googling "cron percent"? You would have found this information easily. – Barmar Nov 13 '21 at 02:28
  • Thanks very much for your help. I literally spent ages googling "Cron %" and "Cron url encoding" and "Cron special characters" and reading all the results and nothing showed up. Thank you for directing me the exact terminology require to find the answer. – nicole2292 Nov 14 '21 at 04:03

0 Answers0