Re: fsockopen & cookies
| From: | Andy Worthington | Date: | Tue, 13 Jun 2000 21:33:00 +0000 |
| Subject: | Re: fsockopen & cookies | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1763@lists.php.net to get a copy of this message | ||
you send the cookie back like this:
$fp = fsockopen("www.php.net", 80, &$errno, &$errstr, 30);
if(!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs($fp,"GET / HTTP/1.0\n");
fputs($fp,"Cookie: ssuid=1l1PM0000ec00047ekqqa49162\n\n");
}
There is a class on http://phpclasses.upperdesign.com/ by Manuel Lemos
that
implements get and post (application/x-www-form-urlencoded) request to http
servers as well as handles cookies. I have a copy of it that I have
modified to also implement post (multipart/form-data) with file upload
capability and fixes an error with the cookie handling in the original
class.
Andy
----- Original Message -----
From: "moshe" <mosdoron@netvision.net.il>
To: <php-general@lists.php.net>
Sent: Tuesday, June 13, 2000 5:13 PM
Subject: Re: [PHP-GENERAL] fsockopen & cookies
> thanks Ben.
>
> can u exem if please for exemple:
> i have cookie -
> ssuid=1l1PM0000ec00047ekqqa49162; path= /;
> and want send it to www.php.net
>
> where it's need to be combined this request:
>
> $fp = fsockopen("www.php.net", 80, &$errno, &$errstr, 30);
> if(!$fp) {
> echo "$errstr ($errno)<br>\n";
> } else {
> fputs($fp,"GET / HTTP/1.0\n\n");
> }
>
> thnks moshe.
>
>
> Ben Peter wrote:
>
> > moshe,
> >
> > it's all up to the client to send the cookie when it sees that a request
> > goes to a URL it has a cookie for. Say, server www.foo.bar has set you a
> > cookie 'cook=100', it is up to you to store that cookie somewhere and
send
> > it along next time you send a request to that server.
> >
> > This would include expiration checks and URL checks (to which servers
will
> > a cookie be sent, will it be sent on any request to a server or does it
> > only belong to a specific subdirectory, etc...)
> >
> > Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>