【问题标题】:file_get_contents dont work?file_get_contents 不起作用?
【发布时间】:2011-07-11 16:36:41
【问题描述】:

服务器:PHP 5.3

有问题的行:

file_get_contents(http://subdomain.domain.com/Api/id);

http://subdomain.domain.com/Api/id 我有这个:

$newFeeds = new newsFeeds();
$newFeeds->function($newsFeedParseFile); //insertamos a memcachedb

从这里它不起作用

$redis = cacheFactory::get('redis');    
$redis->addTolist("Info_{1_2_FS}", "InfoRedis");

我没有收到任何错误,只是没有添加到队列中。

当我复制地址http://subdomain.domain.com/Api/id并粘贴到地址栏中时,我得到了我想要的响应!

【问题讨论】:

  • 代码准确吗?我看到语法错误:缺少引号。
  • 该子域站点是否与运行执行 file_get_contents 的脚本的站点在同一台机器上提供服务。一些托管服务提供商有防火墙设置,可以防止机器通过 TCP 与自己通信。

标签: php queue redis file-get-contents


【解决方案1】:

在您的 php.ini 中验证“allow_url_fopen”是否为 On,如果不是,请将其更改为 On。

【讨论】:

    猜你喜欢
    • 2012-08-30
    • 2013-06-30
    • 2014-11-16
    • 2015-03-12
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多