
Temel Nazli - 2011-02-24 18:38:47
I would like to send few cookies with my GET or POST request.
Currently what i do is:
$http=new http_class;
$url="http://www.fbi.gov/fun-games/"; //worth visiting :)
$http->prefer_curl=1;
$http->follow_redirect=0;
$http->debug=0;
$http->html_debug=0;
$error=$http->GetRequestArguments($url,$arguments);
$arguments[Headers]["Cookie"]="mycookie=bla bla bla; myothercookie=talking about the revolution; mylastcookie=i am the most delicious cookie here"
$error=$http->Open($arguments);
if($error=="")
{
$error=$http->SendRequest($arguments);
.......more code here.....
}
So i actually set the cookies manually by declaring them in the Request headers.
My question[s]:
is there a better way to do it? Is there a method for that?
Also, i could not find any info about the methods of the class. Could be great if someone case explain:
PickCookies(&$cookies,$secure)
SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0)
SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0)
SavePersistentCookies(&$cookies, $domain='', $secure_only=0)
GetPersistentCookies(&$cookies, $domain='', $secure_only=0)
RestoreCookies($cookies, $clear=1)
Many Thanks!