开发者

simplexml_load_file() error

开发者 https://www.devze.com 2023-01-27 03:05 出处:网络
I\'m relative开发者_运维问答ly new with PHP and more so with XML. I have a script working perfectly on my localhost, but when I try and put it on my Server, I get this message:

I'm relative开发者_运维问答ly new with PHP and more so with XML.

I have a script working perfectly on my localhost, but when I try and put it on my Server, I get this message:

Warning: simplexml_load_file() [function.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:1:

parser error : Document is empty in /home2/alsweet/public_html/notalone.php on line 21

The line of code which is not working is this:

// 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');

Have I made a mistake? Should I be speaking to my hosting provider?


Using the url you have in your xml loader I get:

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

So it should be parsing fine. Check with your hosting provider to make sure simplexml_load_file is supported.


Try isolating that line and see if that it indeed where the problem is coming from. Run this code in its own file and see if that works.

<?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);

?>


this was infact a problem with my hosting,

it turns out it was becuase i was trying to call out to another server on port 8080 which was not open outbound in the firewall. so they opened it and it works fine.

thanks a lot for the help!

0

精彩评论

暂无评论...
验证码 换一张
取 消