php脚本错误,权限被拒绝

时间:2014-01-10 03:01:18

标签: php linux

我写了一个PHP脚本来检索我的Google评论,它在我的Wamp服务器上运行正常。但是,当我将它移动到我的实际主机时,我收到此错误:

  

警告:file_get_contents(https://maps.googleapis.com/maps/api/place/details/json?reference=CoQBeAAAAK9bAE7g15Db0Xl4lmd371L8qLBpPHitJl7iI9GT6LYS0BheLRQZzvKXqNHevt08DH0fB7inlvcLby83yUSjzNeH5-n41HxtC60tYG9bE-B15PbShGHnQpy3wsvOoOsRtjmOCnEiaSmlsSWgM2hypXcEeHjh2NiFSXVbEo8pVTRXEhCZSqsHiAEWHhOflDaqXP9oGhQU8WS8PRwxFf7IaiPLWfxaA69csw&sensor=true&key=mykey)[function.file-get-contents]:无法打开流:第8行/home/www/advancedcomputing.us/reviews.php中的权限被拒绝

我在reviews.php上设置了777的权限,但仍然是同样的错误。显然它将数据存储在我无法访问的文件中,但我不知道是哪个文件。任何帮助将不胜感激。

以下是代码:

<style>
.text{font-size:8pt;color:black;font-weight:normal;font-family:arial}
.name{font-size:10pt;color:black;font-weight:bold;font-family:arial}
</style>

<?php
$url = "https://maps.googleapis.com/maps/api/place/details/json?reference=CoQBeAAAAK9bAE7g15Db0Xl4lmd371L8qLBpPHitJl7iI9GT6LYS0BheLRQZzvKXqNHevt08DH0fB7inlvcLby83yUSjzNeH5-n41HxtC60tYG9bE-B15PbShGHnQpy3wsvOoOsRtjmOCnEiaSmlsSWgM2hypXcEeHjh2NiFSXVbEo8pVTRXEhCZSqsHiAEWHhOflDaqXP9oGhQU8WS8PRwxFf7IaiPLWfxaA69csw&sensor=true&key=mykey";
//$jsonfile= file_get_contents($url);

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: en-us'));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$jsonfile = curl_exec($ch);
curl_close($ch);
$data = json_decode($jsonfile);


$data = json_decode($jsonfile);

echo "<table cellpadding=0 cellspacing=0 width=250 border=0 bgcolor=white><tr><td align=center valign=bottom><a href=https://plus.google.com/114172317884481430965/about?hl=en style=color:blue;font-size:8pt;font-family:arial;>see all reviews</a></td></tr><tr><td height=5></td></tr>";

for($x=0;$x<sizeof($data->result->reviews);$x++){
echo "<tr>";
echo "<td class=name class=text style=padding-left:15px;>";
echo $data->result->reviews[$x]->author_name;
echo "&nbsp;&nbsp;";
echo date("m-d-Y", $data->result->reviews[$x]->time);
echo "</td></tr><tr><td class=text style=padding-left:15px;>";
if($data->result->reviews[$x]->rating==5){echo "<img src=star.png><img src=star.png><img src=star.png><img src=star.png><img src=star.png>";}
if($data->result->reviews[$x]->rating==4){echo "<img src=star.png><img src=star.png><img src=star.png><img src=star.png>";}
if($data->result->reviews[$x]->rating==3){echo "<img src=star.png><img src=star.png><img src=star.png>";}

echo "</td></tr><tr><td class=text style=padding-left:15px;>";
echo $data->result->reviews[$x]->text;
echo "</td></tr>";
echo "<tr><td height=15></td></tr>";
}
?>
</table>

0 个答案:

没有答案