homepage Welcome to WebmasterWorld Guest from 54.205.144.231
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
simplexml load file problem
WoodNotOil




msg:4262966
 10:52 pm on Feb 4, 2011 (gmt 0)

So I am trying out this tutorial below to get the hang of utilizing the isbndb.com api:
[webhole.net ]

Everything came together fine, but when I run a search I get errors from the simplexml_load_file function.

I get first this error:
failed to open stream: Connection refused
Then this error:
I/O warning : failed to load external entity

My server account at Batcave.net is using PHP 5.2.5 so simplexml_load_file should be able to work. Also, when I go to the url directly ("http://isbndb.com/api/books.xml?access_key=O4FQEY32&results=details&index1=isbn&value1=1932073205" for example)in a browser it displays the xml, so it appears that url is correct for connecting to the isbndb.

Any help getting this working would be appreciated. Thanks!

 

WoodNotOil




msg:4263065
 1:52 pm on Feb 5, 2011 (gmt 0)

Perhaps it would be easier if someone could just give me a simple way of displaying the xml result from the url below using php.

[isbndb.com...]

I thought the tutorial I had stumbled on would be a simple way to do that, but I can't understand why these errors are coming up with the simple_xml_file function... Seems like this should be a relatively simple task...

Little_G




msg:4263077
 3:26 pm on Feb 5, 2011 (gmt 0)

Hi,

Is it possible your hosting provider has placed restrictions on making external connections?

A simple way to test would be:

<?php
echo file_get_contents("http://google.com/");
?>


Andrew

WoodNotOil




msg:4263091
 4:52 pm on Feb 5, 2011 (gmt 0)

Seems that way. Your code produced this error:

"file_get_contents(http://google.com/) [function.file-get-contents]: failed to open stream: Connection refused in"...

I don't suppose there is anything that I can do about this? Is there anything in php.ini that can be changed to allow external connections?

Little_G




msg:4263112
 7:27 pm on Feb 5, 2011 (gmt 0)

Hi,

There is a option in php.ini [php.net] to disable requests using external urls, but it doesn't give the same error as you're getting when enabled so it probably isn't that.

"Connection refused" suggests server settings or a firewall stopping your script from connecting out, you probably have to upgrade your package to be able to do that. :(

Andrew

WoodNotOil




msg:4263113
 7:35 pm on Feb 5, 2011 (gmt 0)

I contacted my host provider and they confirmed that you were correct, that they had placed restrictions on making external connections. They were nice enough to enable them for my account and everything is working now! Thanks for your expertise!

Little_G




msg:4263121
 7:58 pm on Feb 5, 2011 (gmt 0)

Happy to help!

Andrew

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved