Reputation: 21
I am facing a really wired situation, i have two URLs from where i am reading XML content. below is my simple script.
$a1 = file_get_contents('http://xml.propspace.com/feed/xml.php?cl=1678&pid=2323&acc=2323');
var_dump($a1);
echo '<hr>';
$a2 = file_get_contents('http://xml.propspace.com/feed/xml.php?cl=1066&pid=9922&acc=1154');
var_dump($a2);
The first link "a1" exists but when i try to read the URL through file_get_content it gives me warning.
Warning: file_get_contents(http://xml.propspace.com/feed/xml.php?cl=1678&pid=2323&acc=2323): failed to open stream: HTTP request failed! HTTP/1.1 404 NOT FOUND in serverFilePath/yooy.php on line 2
with return bool(false)
and the other link "a2" is working fine and returning the XML Feed.
Any advice.?
Here is a screenshot of the code output run on a single page.
Upvotes: 0
Views: 258
Reputation: 13928
As a matter of fact, the links that you posted($a1
, $a2
), well one of them isn't working, guess which one.
Following is the error that is being returned while accessing $a1
.
Error code: 1001 happened, please check with customer support immediately.
For assistance, please contact [email protected].
While working on an external link/API, Always make it a habit to first make a request to it from outside of PHP, doing so shall rule out any possibilities of errors on the other end, and shall save a lot of valuable debugging time.
If its a simple GET request then simply navigating to it in a browser will do, but if its POST then you can use Postman extension for chrome it works flawless for me.
Upvotes: 1