2010/6/13 David Česal <da...@cesal.cz>:
> Hello,
> I'm trying to access (from CLI) some website, where login is required.
> Please, is it possible to set/save some cookies first (login session
> information) and then access the website as logged user? All through CLI.
> Thank you very much for any information.
> David Cesal

Beside cURL, you can also use stream contexts to get/set the cookie
for subsequent requests.


Essentially, you create a context when you send the data (this will
allow you to POST data for a file_get_contents() call).

Then you get the meta data from the response.

Then you put the cookie you received into the context you will use to
continue in communication.

If you set up the default context in this way, then you don't need to
supply the context to every file command.

See the user notes on file_get_contents regarding routing calls
through an NTLM proxy. By creating a default context, all my code was
routed through an NTML proxy. PHP didn't support NTLM authentication
when I wrote the note (not sure it does yet, but my requirement

By using a default context, I have 1 place to edit any code (in my
auto_prepend.php script).


Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to