I have a problem with running the script using scheduled cron jobs. The thing is that when I run the php script using the browser it is executed without any problems/failures etc.
But when I try to run it using crons or SSH I get weird errors:
Notice: Undefined index: HTTP_USER_AGENT in /home/loves/public_html/parser/shop_parse_class.php on line 125
PHP Notice: Undefined offset: 0 in /home/loves/public_html/parser/shop_parse_class.php on line 481
PHP Notice: Undefined offset: 1 in /home/loves/public_html/parser/shop_parse_class.php on line 482
PHP Notice: Undefined variable: cat in /home/loves/public_html/parser/shop_parse_class.php on line 538
As you can see from the errors it shows that, for example the option HTTP_USER_AGENT doesn’t exist for the CURL, which is kinda weird. Maybe the problem is with the environment variables, however I have poor knowledge of linux system.
You should add the
-Aor--user-agentparameter to the cURL call.You can set anything you want as user agent this way.