Jump to content

Why is curl returning crazy characters? (�����<ӆ)...


physaux

Recommended Posts

Hey guys, curl is returning me funny stuff- like this:

)|����<ӆ���@���eih��m�w#�0<�

 

Pretty much a whole screen of this. I re-arranged it just incase it was something sensetive, but it is all random junk like that. It is supposed to be a normal page. Anyone have any clues/ suggestions??

You might be getting a compressed response or something that is not supposed to be readable.  Try

 

curl_setopt($ch, CURLOPT_HEADER, true);

 

assuming $ch is your curl handle, and see if there's any clues in there.  It might tell you the file is compressed (content-encoding), or it might tell you that you are getting something that is not plain text or html (content-type)

Ok, that's gzipped.  There's two options here - first is to tell the server you don't want gzipped pages, second is to decompress them.

 

To implement the first I think you need to set the Accept-encoding header.  I don't have the detail of what you can set it to, you'll need to find that yourself.

 

To implement the second, apparently there is a gzdecode() function but only in php 6.  But perhaps you can write the data to a file and then use gzopen() and gzread() to decompress it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.