physaux Posted January 22, 2010 Share Posted January 22, 2010 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 https://forums.phpfreaks.com/topic/189394-why-is-curl-returning-crazy-characters-%1A%EF%BF%BD%EF%BF%BD%10%EF%BF%BD/ Share on other sites More sharing options...
JAY6390 Posted January 22, 2010 Share Posted January 22, 2010 If you are viewing this in firefox, try going to View > Character Encoding > Western (iso-8859-1) and see if that shows them normally Link to comment https://forums.phpfreaks.com/topic/189394-why-is-curl-returning-crazy-characters-%1A%EF%BF%BD%EF%BF%BD%10%EF%BF%BD/#findComment-999742 Share on other sites More sharing options...
btherl Posted January 22, 2010 Share Posted January 22, 2010 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 https://forums.phpfreaks.com/topic/189394-why-is-curl-returning-crazy-characters-%1A%EF%BF%BD%EF%BF%BD%10%EF%BF%BD/#findComment-999756 Share on other sites More sharing options...
physaux Posted January 22, 2010 Author Share Posted January 22, 2010 I tried curlopt_header true, and here is what I got: Content-Encoding: gzip Vary: Accept-Encoding Content-Length: 762 Connection: close Content-Type: text/html; charset=UTF-8 Any idea how I can view that? Link to comment https://forums.phpfreaks.com/topic/189394-why-is-curl-returning-crazy-characters-%1A%EF%BF%BD%EF%BF%BD%10%EF%BF%BD/#findComment-999936 Share on other sites More sharing options...
btherl Posted January 24, 2010 Share Posted January 24, 2010 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 https://forums.phpfreaks.com/topic/189394-why-is-curl-returning-crazy-characters-%1A%EF%BF%BD%EF%BF%BD%10%EF%BF%BD/#findComment-1000706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.