Tom Posted March 18, 2011 Report Posted March 18, 2011 Hello, After moving to fivedev hosting I'm seeing the following error on my site: Warning: simplexml_load_file() [function.simplexml-load-file]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 I'm reading an XML file on another domain. Does anyone know how I can work around this? Thanks Quote
Moderators Kyle Posted March 18, 2011 Moderators Report Posted March 18, 2011 IT looks like Nabeel's config needs to enable one of allow url fopen. Quote
Administrators simpilot Posted March 18, 2011 Administrators Report Posted March 18, 2011 You are going to have to use curl to get the file, inside of phpVMS you could use something like; $url = 'http://www.site.com/file' $file = new CodonWebService(); $contents = @$file->get($url); Quote
Moderators mark1million Posted March 19, 2011 Moderators Report Posted March 19, 2011 Hello, After moving to fivedev hosting I'm seeing the following error on my site: Warning: simplexml_load_file() [function.simplexml-load-file]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 I'm reading an XML file on another domain. Does anyone know how I can work around this? Thanks Are you getting xml route info from vroute? Quote
Administrators Nabeel Posted March 19, 2011 Administrators Report Posted March 19, 2011 Yes, you have to use cURL to retrieve the document. I have to look into enabling stream wrappers in fopen and the like, but it's generally recommended to have it disabled for security Quote
Tom Posted April 29, 2011 Author Report Posted April 29, 2011 Ok so, following this I've got this far: // Check email for known spammer $url = 'http://www.stopforumspam.com/api?email='.$email.'&f=xmlcdata'; $file = new CodonWebService(); $contents = @$file->get($url); echo $contents; With that last echo being there to see what I'm getting back. Currently I'm getting nothing at all. Yes, $email has a value... Where am I going wrong? In addition, once I've loaded the xml, how am I supposed to do anything with it? Quote
Administrators Nabeel Posted May 1, 2011 Administrators Report Posted May 1, 2011 Take out that @, that's supressing errors Quote
Tom Posted May 5, 2011 Author Report Posted May 5, 2011 $url = 'http://www.stopforumspam.com/api?email='.$data['email'].'&f=xmlcdata'; //$params = array('email' => $data['email'], 'f' => 'xmlcdata'); $file = new CodonWebService(); $contents = $file->get($url); $response = simplexml_load_string($contents); echo $contents; Moved where it is so I'm now using $data['email'], but echoing contents still just returns nothing :? Quote
Administrators Nabeel Posted May 6, 2011 Administrators Report Posted May 6, 2011 Are you using that URL properly? With this code: <?php include 'phpvms/core/classes/CodonWebService.class.php'; echo '<pre>'; $url = 'http://www.stopforumspam.com/api?email=nabeel@&f=xmlcdata'; $file = new CodonWebService(); $contents = $file->get($url); var_dump($contents); $response = simplexml_load_string($contents); echo $contents; On this page: http://fivedev.net/test.php Something is being returned - $contents is a 190 character string(of spaces apparently?) Quote
Tom Posted May 6, 2011 Author Report Posted May 6, 2011 Ah, they appeared to be having problems with their strict xml output, without that last variable it seems to be working fine. Got it working as expected now. Thanks a lot I'm going to post my code in the snippets forum just in case anyone else is having a spam problem Quote
Administrators Nabeel Posted May 6, 2011 Administrators Report Posted May 6, 2011 Ah, they appeared to be having problems with their strict xml output, without that last variable it seems to be working fine. Got it working as expected now. Thanks a lot I'm going to post my code in the snippets forum just in case anyone else is having a spam problem Do they have json output? I'd use that, easier than parsing XML, though in the end it would be the same. JSON would use less bandwidth: $contents =- ... $contents = json_decode($contents); echo $contents->variable Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.