You are here:  » Parser works here, but not there!


Parser works here, but not there!

Submitted by griffinsbridge on Tue, 2007-11-13 12:12 in

Hi

I've got a feed that parses perfectly on your installation of magic Parser in the demo, but it won't parse on my server. When I try and run a very simple parse I just get a blank page within a couple of seconds (rather than the couple of minutes I expect a 13Mb file to take). Ive debugged right down to this simple function:

<?php
function myRecordHandler($record)
  {
print_r($record);
}
    
?>

All other feeds parse fine, it's just this one. I've validated the feed as "well formed" too, so I'm at a complete loss.

With the file size being so large and me having 50+ feeds to parse, i am attempting to first download and cache the feeds, then later parse them to insert into a Database.
I am getting the feed using this code:

<?php
$myFile 
'Cache/FILENAME.xml';
$infile fopen("".$FileToDownload."""r");
$outfile fopen("".$myFile."""w+");
while( !
feof($infile))
{
  
$buffer fgets($infile);
  
$leng strlen($buffer);
  
fputs($outfile$buffer$leng);
}
fclose($outfile);
fclose($infile);
?>

that works fine. All cached feeds appear to be well formed and exactly as expected. I just can't parse this one feed!!

Would you mind taking a look please?

Many Thanks

~Note~
feed URL:
{link saved}

Submitted by support on Tue, 2007-11-13 12:24

Hi,

I just downloaded the link you posted as cpw.xml, and it has parsed fine using the format string:

xml|PRODUCTS/PRODUCT/

Here is the code I used:

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($record)
  {
    
print_r($record);
    return 
TRUE// stop parsing
  
}
  
MagicParser_parse("cpw.xml","myRecordHandler","xml|PRODUCTS/PRODUCT/");
?>

...and the start of the output:

Array ( [PRODUCT] => [PRODUCT_CODE] => 18222 [PRODUCT_NAME] => Nokia 8600 Luna on Orange Racoon £30 18mth, with 400 mins & 100 txts a month [BRAND_NAME] => Nokia [LEVEL1] => Mobile Phone [LEVEL2] => Contract [LEVEL3] => [LEVEL4] => [LEVEL5] => [MAPPED_CAT_LEVEL1] => Mobile Phones [MAPPED_CAT_LEVEL2] => Contract [MAPPED_CAT_ID] => 372 )

(i've removed most of it so that your site / affiliate ID is not shown)

Could you try the same code?

Cheers,
David.

Submitted by griffinsbridge on Tue, 2007-11-13 12:48

Hi David.

Thanks for the quick response.

Ive tried the exact code you posted and still no dice. Yet it still works fine with other feeds.
tried downloading and caching the feed again, but nope!

Ive even tried overwriting MagicParser.php with the original archived file I downloaded, just in case of any corruption, and it hung for a tantilising few extra seconds (just to get my hopes up) but returned to the blank page.

There's no errors in my server logs either.

I'm starting to consider removing this feed altogether

Submitted by support on Tue, 2007-11-13 12:52

Hi,

Have you checked for any error message from the parser, for example, add the following to the bottom of your test script:

print MagicParser_getErrorMessage();

That might reveal something...

Cheers,
David.

Submitted by griffinsbridge on Tue, 2007-11-13 13:08

Hi

I wasn't aware of that function, could come in useful, but no, it doesn't reveal anything at all this time.

I won't give up until you do!!

Submitted by support on Tue, 2007-11-13 13:19

Hi,

Could you create a couple of test files, one reading the carphone warehouse feed (not working) - call it test1.php and another reading one of the feeds that does work - call it test2.php.

If you could then send me a link to both files, and each file as an attachment i'll take a look and try to understand what's going on...

Reply to your reg code or forum registration email is the easiest way to get me...

Cheers,
David.

Submitted by griffinsbridge on Tue, 2007-11-13 13:45

Email sent david.

Many Thanks