2010-11-28 32 views
4

我对PHP相对较新,更多的是使用XML。simplexml_load_file()错误

我有一个脚本在我的本地工作完美,但是当我试图把它在我的服务器上,我得到这个消息:

警告:使用simplexml_load_file() [function.simplexml加载文件]: http://api.wefeelfine.org:8080/ShowFeelings?display=xml&feeling=happy&returnfields=imageid,feeling,sentence,posttime,postdate,posturl,gender,country,state,city,lat,lon&limit=0&extraimages=20:1

分析器错误:文档是空的在 /home2/alsweet/public_html/notalone.php 第21行

不工作的代码行是这样的:

// get api feed 
$xml = simplexml_load_file('http://api.wefeelfine.org:8080/ShowFeelings?display=xml&feeling=' . $feeling . '&returnfields=imageid,feeling,sentence,posttime,postdate,posturl,gender,country,state,city,lat,lon&limit=0&extraimages=20'); 

我犯了一个错误吗? 我应该向我的托管服务提供商说话吗?

回答

0

这是一个逸岸问题,我的主机,

事实证明这是监守我试图调出端口8080上的另一台服务器这是不是在防火墙中打开出站。所以他们打开它,它工作正常。

非常感谢您的帮助!

1

在你的XML装载机使用您的网址获得:

<?xml version="1.0"?> 
<feelings> 
</feelings> 

所以应该解析罚款。检查您的托管服务提供商以确保simplexml_load_file受支持。

+0

我不认为这是在他使用其只是错误输出的实际URL。看到他的源代码没有“:1” – KTastrophy 2010-11-28 20:45:48

+0

@KThompson你说得对,我没有翻看过。当使用他的网址时,我得到一个空集。 – wajiw 2010-11-28 20:48:36

0

尝试隔离该行,看看它是否确实出现问题。在自己的文件中运行这段代码,看看是否有效。

<?php 
$xml = simplexml_load_file('http://api.wefeelfine.org:8080/ShowFeelings?display=xml&feeling=happy&returnfields=imageid,feeling,sentence,posttime,postdate,posturl,gender,country,state,city,lat,lon&limit=0&extraimages=20'); 

print_r($xml); 

?> 
相关问题