Jump to content

simplexml on fivedev


Tom

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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?

Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
Share on other sites

$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 :?

Link to comment
Share on other sites

  • Administrators

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

  • Administrators

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...