2013-02-07 35 views
1

所以我有这个网址http://my-server.com/feeds/feed.pl?op=retrieveIncidents&type=social,government&cbsa=31100,其中包含由另一个进程构建的xml数据。现在我使用file_get_contents()与硬编码的网址,它的工作完美。在开发的这个阶段,我必须开始使用配置文件和登录应用程序的当前用户的cbsa代码。file_get_content(转换为htmlspecialchars)

现在这个/feeds/feed.pl?op=retrieveIncidents&type=social,government&cbsa=来自config。

31100来自用户对象。

这个http://my-server.com来自助手fn()。

$server = $this->serverUrl(); 
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini', APPLICATION_ENV); 
$curOperator = Default_Model_Operator::getActiveOperator(); 

$feedUrl = $server.$config->ims->idfFeed.$curOperator->regions; 

如果我打印/回声$feedUrl看起来像http://my-server.com/feeds/feed.pl?op=retrieveIncidents&type=social,government&cbsa=31100

但是当我做$feed = file_get_contents($feedUrl)我得到
警告:的file_get_contents(http://vdot.orion.meridian-enviro.com/feeds/feed.pl?op=retrieveIncidents&类型=社会,政府& CBSA = 31100)函数.file-get-contents]:无法打开流:HTTP请求失败! HTTP/1.1 404 未找到 /home/Agena/lvegerano/svn/webapps/ims/trunk/phpfiles/application/views/scripts/chp/list-for-dashboard.phtml上线

记下&。我试过htmlentities_decode()urlencode()和其他,不能得到这个工作。我能做些什么file_get_contents()翻译&&

如何解决这个问题的任何帮助将不胜感激。

+0

在使用'file_get_contents'之前,您将需要解码实体。当你输出url时,它的浏览器可能正在解码实体,但是如果你要查看源代码,实体将是可见的。 – datasage

+0

我已经尝试过'$ feedUrl = htmlspecialchars_decode($ feedUrl);''file_get_contents()'之前''不起作用。 – LouieV

+0

通过解码运行后得到的url是什么? – datasage

回答

0

我想我忘了回答这个问题。问题是我们的清漆设置。它设置为查找URL,如果识别插入主机名。因为我刚刚在这里工作,所以我不知道这个功能。因此,我认为这是错误的,因为清漆掩盖了网址。