tags:

views:

27

answers:

1

acces the page with this code, then it get's the cookie, this is my curl code

$ckfile = tempnam ("/tmp", "CURLCOOKIE"); 

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/3.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".$_SERVER['REMOTE_ADDR'], "HTTP_X_FORWARDED_FOR: ".$_SERVER['REMOTE_ADDR']));
    curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec ($ch);

i want to set the information stored in the ckfile to the user, how can i do that

A: 

You can pick up the cookie value from the cookie file you have mentioned in your curl code and by using setcookie() send that value to the user.

However if you think that the cookie will be usable on the site you have opened with CURL, it would be incorrect. Any cookie you create on your site will be ONLY accessible on your site and would have no bearing on any other site.

Sabeen Malik