You are here:  » enabling URL wrappers


enabling URL wrappers

Submitted by komra on Thu, 2006-08-31 19:07 in

Magic parser is much appreciated. I bought a copy because the demo worked perfectly for the xml I needed to parse.

But it appears that there must be some difference in the settings between my server and the demo. It's gotta be something simple... :)
I am using the recommended code from the demo:
http://www.marketingvox.com/utilities/magicparser/mv.php

The MP test works...
http://www.marketingvox.com/utilities/magicparser/MagicParserTest.php

<?php
require("MagicParser.php");
function myRecordHandler($record)
{
// This is where you write your code to process each record, such as loading a database
// Here we just display the record contents using PHP's internal print_r() function
print_r($record);
}
MagicParser_parse("http://www.imediaconnection.com/jobs/tools/xml.aspx?id=mv","myRecordHandler","xml|JOBFEED/JOB/");
?>

Submitted by support on Thu, 2006-08-31 20:47

Hi There,

This is almost certainly because URL wrappers are not enabled on your server, so PHP cannot open the URL directly.

The first thing to add to your code is to print the debug message returned by MagicParser_getErrorMessage()... for example:

<?php
require("MagicParser.php");
function 
myRecordHandler($record)
{
// This is where you write your code to process each record, such as loading a database
// Here we just display the record contents using PHP's internal print_r() function
print_r($record);
}
MagicParser_parse("http://www.imediaconnection.com/jobs/tools/xml.aspx?id=mv","myRecordHandler","xml|JOBFEED/JOB/");
print 
MagicParser_getErrorMessage();
?>

URL wrappers need to be enabled in your PHP installation - however you may need to request this from your host - I know that people have been successful in getting them enabled. Please see the following page for more information...

http://uk2.php.net/manual/en/function.fopen.php

http://uk2.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen

Let me know how you get on - there may be other ways around it if you are not able to get URL wrappers enabled on your server...

Cheers,
David.

Submitted by komra on Fri, 2006-09-01 14:35

thanks, that works great. BTW on my server I can activate URL wrappers in the .htaccess file by adding this string:

php_flag allow_url_fopen on