file_get_contents(url)无法打开流:HTTP请求失败! HTTP / 1.1 400错误请求

时间:2015-06-11 06:22:24

标签: php html mysql curl

当我尝试打开链接时,我今天开始收到此错误。 我尝试了curl版本,但仍然遇到同样的错误。我将cloudfare添加到我的网站时发生了此错误。它有效果吗?

这是我的代码:

<?php
  include'config.php';
  $items = mysql_query("SELECT * FROM phil");
  $thispage = $PHP_SELF;
  $num = mysql_num_rows($items);
  $per_page = 500;
  $start = @$_GET['start'];
  if(empty($start)) $start = 0;
    ?>
      <center>
        <?php
          if($start+$per_page<$num){
            ?>
              [<a href="<?php print("$thispage?start=".max(0,$start+$per_page)); ?>">Next Like</a>]
            <?php
          }

    $result = mysql_query("SELECT * FROM phil ORDER BY id LIMIT $start,$per_page");
    if($result){
      while($row = mysql_fetch_array($result))
      {
        $token = $row[access_token];
        $userData = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$token.'&fields=name,id'),true);print($userData[name]).'<br/>';
       if(!$userData[name]){
         mysql_query("
                    DELETE FROM
                    phil
                    WHERE
                    access_token='" . mysql_real_escape_string($token) . "'
                  ");
       }
     }
   }
?>

0 个答案:

没有答案