tags:

views:

141

answers:

2

Hello, Sir. I have a problem in implementing Mashups in PHP. Now I am using PHP Version5.

I want to fetch flickr photo information from the site. And I think the code is correct. But I always face such errors as follows;

Here is my php code:

<?php
header('Content-Type: text/xml');
?>
<?php
$url="http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&amp;api_key=46566747d88fe250fd631deb0033023a&amp;user_id=64002153@N00";
$url=DOMDocument::load($url);
echo $url->saveXML();
?>

As you can see I am going to fetch remote xml file from flickr site. But I am always stalled by this error:

Warning: DOMDocument::load() [function.DOMDocument-load]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\mashup\k\flickrproxy.php on line 13

Warning: DOMDocument::load(http://...@N00) [function.DOMDocument-load]: failed to open stream: No such file or directory in C:\wamp\www\mashup\k\flickrproxy.php on line 13

Warning: DOMDocument::load() [function.DOMDocument-load]: I/O warning : failed to load external entity "http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&amp;api_key=46566747d88fe250fd631deb0033023a&amp;user_id=64002153@N00" in C:\wamp\www\mashup\k\flickrproxy.php on line 13

You can just think that the remote file does not exist but there it is. link text

This is a accurate xml file as you can see.

Please help me with this.

Thank you.

A: 

May be allow_url_open is disabled.

try reading http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&amp;api%5Fkey=46566747d88fe250fd631deb0033023a&amp;user%5Fid=64002153@N00 by other means on your server, like wget-ing or curl-ing it.

Ivan Krechetov
Thank you.My allow_url_open property is set.But it doesn't work still.
Jin
Can you get the content opening this URL in the browser?
Ivan Krechetov
A: 

It looks like your server is not able to connect to the flickr site, possibly due to firewall or DNS settings or, as @Ivan points out, due to PHP configuration (although I believe the error message would be a different one then).

What kind of server are you running?

Also, can you try loading the file from the local domain (localhost or 127.0.0.1)? Does it work then?

It could also be a DNS problem. Does the flickr server offer access by IP instead of a hostname?

Pekka
I wrote earlier sir.I can just do the work within my local domain.Hope for reply
Jin
What kind of server are you running? Have you tried it using an IP address?
Pekka