【问题标题】:where i can find file_get_contents() function and repalce it with Curl我可以在哪里找到 file_get_contents() 函数并将其替换为 Curl
【发布时间】:2015-01-09 12:44:00
【问题描述】:

我可以在哪里找到 file_get_contents() 函数并用 Curl 替换它

遇到了 PHP 错误

严重性:警告

消息:file_get_contents() [function.file-get-contents]: https:// wrapper 在服务器配置中被allow_url_fopen=0 禁用

文件名:controllers/videos.php

行号:281

【问题讨论】:

  • 嗯,正如它所说,您可以在文件controllers/videos.php...中找到该调用...

标签: function curl file-get-contents


【解决方案1】:

编辑文件controllers/videos.php 并将file_get_contents() 调用替换为libcurl 调用,如下所示PHP : how can use curl instead file_get_contents,因此:

$url = "https://graph.facebook.com/" . base_url() . "videos/videos_watch/" . $id_video';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);       
$data = curl_exec($ch);
curl_close($ch);
// do something with $data

【讨论】:

  • (file_get_contents("graph.facebook.com" . base_url() . "videos/videos_watch/" . $id_video));
  • 根据评论添加网址
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-14
  • 1970-01-01
  • 1970-01-01
  • 2023-01-30
  • 2012-08-08
  • 2014-07-16
相关资源
最近更新 更多