You are here:  » Can not get same results as online demo

Can not get same results as online demo

Submitted by Strikeplate on Wed, 2009-07-15 18:50 in


In trying your online demo I was able to get the exact results I'm looking for on a file I need to parse. However, after buying the product and using the PHP generator code all I get is a blank page. Here is the generated code:

// This is where you write your code to process each record, such as loading a database
    // You can display the record contents using PHP's internal print_r() function:
// The following code will print out each field in your sample data:
print $record["DEALERS"];
MagicParser_parse("{link saved}","myRecordHandler","xml|SSORES:SSORESPONSE/USERPROFILE/DEALERS/");

I am putting this code in a file named "response.php" and when I browse to it...nothing. Please note that the only change I made to the code above is to make the path to MagicParser.php absolute, because this domain is load balanced across 3 servers and it seemed to hang up with the relative path.

I'm in a jam...hope you can help!


Submitted by support on Wed, 2009-07-15 19:16


This is almost certainly because your web server is not permitting fopen() to access Internet URLs. The first thing to try would be to display the Magic Parser error message as follows;

  MagicParser_parse("{link saved}","myRecordHandler","xml|SSORES:SSORESPONSE/USERPROFILE/DEALERS/");
  print MagicParser_getErrorMessage();

If that indicates that the file could not be opened, that would imply the above. You can find more information about the settings on the following page:

However, it is becoming more common for PHP installations to have CURL compiled in, which is an alternative method for accessing Internet URLs. An alternative to the above code using CURL would be as follows:

  $url = "{link saved}";
  $ch = curl_init($url);
  curl_setopt($ch,CURLOPT_HEADER, 0);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
  $xml = curl_exec($ch);

Don't forget to replace {link saved} with your URL!

Hope this helps,