Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   cURL issue weird characters (http://www.programmingforums.org/showthread.php?t=14795)

jacobb Dec 23rd, 2007 10:06 PM

cURL issue weird characters
 
I am writing a program that will send out invitations to social networking sites I am using curl to connect and get info. On all the sites curl works but on tagged.com it throws me ASCII characters instead of the website. It's like it is encrypted or something.


Here is my code nothing out of the ordinary:


$file_path = '/tmp/cookies.txt';
$ch = curl_init();
curl_getinfo($ch);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,"http://www.tagged.com);
curl_setopt($ch, CURLOPT_COOKIEJAR, $file_path);
$page = curl_exec($ch);
curl_close($ch)
echo $page;


any ideas of why this is happening?

Sane Dec 24th, 2007 12:45 AM

Re: cURL issue weird characters
 
I've never used cURL before, but one of the HTTP header attributes specifies whether or not the response should be compressed or not. This is specified in the "Accept-Encoding" parameter, and maybe since you don't seem to be specifying that, tagged.com assumes a default of compression, whereas most sites will default to no compression.

See section 14.3 in the rfc2616 standard for more information on "Accept-Encoding". Then you could look into how to specify no compression with cURL.

Disclaimer: This might be a total waste of your time, because I've never used cURL and it could be a very different problem. This is just something you could try if you really want to get this resolved asap.

null_ptr0 Dec 26th, 2007 10:11 AM

Re: cURL issue weird characters
 
ord() and substr()


All times are GMT -5. The time now is 3:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC