You are here:  » workaround for feed pull timeouts


workaround for feed pull timeouts

Submitted by vanarie on Fri, 2008-02-01 19:07 in

Thought I'd post this - hope it helps someone.

I found that using Magic's own feed puller is less reliable than pulling it via php fopen function. There are libs out there for this, and I've gotten more consistent results by pulling the feed this way, then parsing the output with Magic.

See reference
http://us2.php.net/manual/en/function.fopen.php#58099

So, this is generally the code:

@$url_pull = new HTTPRequest($url);
@$xmlstring = $url_pull->DownloadToString();
MagicParser_parse("string://".$xmlstring,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");
// instead of: MagicParser_parse($url,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");