我有一个调用 php 脚本的 Cronjob。cronjob 正在执行,因为我将它设置为在它执行时向我发送电子邮件。手动执行时,php 脚本可以正常工作。我相信这可能与权限有关,但我不确定如何检查是否是这种情况。我正在使用godaddy。
这是php脚本:
$dayOfWeek = date('w');
if($dayOfWeek == 1) $xml = file_get_contents('http://xxxxx.com/mon.xml');
if($dayOfWeek == 2) $xml = file_get_contents('http://xxxxx.com/tues.xml');
if($dayOfWeek == 3) $xml = file_get_contents('http://xxxxx.com/wed.xml');
if($dayOfWeek == 4) $xml = file_get_contents('http://xxxxx.com/thurs.xml');
if($dayOfWeek == 5) $xml = file_get_contents('http://xxxxx.com/fri.xml');
if($dayOfWeek == 6) $xml = file_get_contents('http://xxxxx.com/sat.xml');
if($dayOfWeek == 7) $xml = file_get_contents('http://xxxxx.com/sun.xml');
file_put_contents('Bars.xml', $xml);
mysql_connect("xxxx.hostedresource.com", "user", "userpw") or die(mysql_error());
mysql_select_db("dbname") or die(mysql_error());
mysql_query("UPDATE mytable SET isWorking='0' WHERE isWorking='1'") or die(mysql_error());
我收到以下错误消息:
<br />
<b>Warning</b>: file_get_contents(http://xxxxxx.com/fri.xml) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream:
HTTP request failed! HTTP/1.0 403 Forbidden
in <b>/home/content/77/8761477/html/refreshXML.php</b> on line <b>8</b><br />
有什么建议么?
谢谢