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??

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.