cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Help with cookies & cURL

From: AtomixNetwork Internet Services <atomixnetwork_at_gmail.com>
Date: Sun, 27 Nov 2005 18:54:09 +1300

Hi there,

I am currently using this script:

**********************************************
<?php
        $cookie_file_path = "/home/letsgo/cookies/trademe";

        $LOGINURL = "http://www.trademe.co.nz/structure/login.asp";
        $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1 (ax)";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$LOGINURL);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    $result = curl_exec ($ch);
    curl_close ($ch);

        $LOGINURL = "http://www.trademe.co.nz/structure/login.asp";
        $POSTFIELDS =
'url=&test_auto=&email=my-email_at_email.com&password=uhh';
        $referer = "http://www.trademe.co.nz/structure/login.asp";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$LOGINURL);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_REFERER, $referer);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    $result = curl_exec ($ch);
    curl_close ($ch);
    print $result;

?>

*******************************************

But it seems like the site checks to see if the browser has cookies enabled
as it says this on the site:

Your browser does not have
cookies<http://www.letsproxy.com/structure/helpdocs/default.asp?help_id=270#cookies>enabled.
Trade Me may not function properly without cookies turned on.

Is there a way to make cURL tell the site that it has cookies enabled?

Thank you!

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-11-27