In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Trond Arve Nordheim) wrote:

> I was writing a slashdot RSS-parser for my homepage, and wrote a simple
> function to fetch the slashdot.rdf-file from slashdot, and parse it
> using PEAR's XML/RSS.php.
> Here's the core reading the remote file:
> $fp = @fopen("";, "r");
> if (!$fp) { return 0; }
> $raw = fread($fp, 10000);
> fclose($fp);
> Now, it seems like slashdot is doing som on-the-fly gzip-compression (it
> sends a "Content-Encoding: gzip"-header), and that fopen can't cope with
> this, and I'm stuck with some binary data. I've tried using
> gzuncompress() on the returned data, but that resulted in an error (not
> valid gzip-data).

Since no one else has responded yet, I'm going to take a wild guess that 
your browser's "Accept" headers are being used on the fopen() request, 
leading the slashdot server to believe that your script can process gzipped 
data...?  FWIW, I'd try using fsockopen() instead, explicitely setting 
"Accept" (probably to text/html, text/xml, and text/rss--if the latter is a 
valid content type).

BTW, you should take out that @ sign, turn error_reporting all the way up 
to E_ALL, and add some error checking.  Just in case PHP already knows what 
the problem is, and you're not letting it tell you...


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to