NYCPHP Meetup

NYPHP.org

[nycphp-talk] http authentication

Rob Notwicz rob.notwicz at gmail.com
Tue Oct 17 13:40:48 EDT 2006


Do you know where I might be able to find some sample code/walkthrough for
the latter (POST)?

thanks so much,
    Rob

On 10/17/06, csnyder <chsnyder at gmail.com> wrote:
>
> On 10/17/06, Rob Notwicz <rob.notwicz at gmail.com> wrote:
> > Hey all, I need to parse data from pages which are behind a login.  Does
> > anyone know how to do this? I'm kind of unfamiliar with HTTP protocol
> and
> > new to PHP, so anything at all will be helpful.
> >
> >  (there is an http_request function listed on php.net, but the entry is
> > sparse and I can't find any example code for it)
> >
> >  thanks so much,
> >     Rob
>
>
> If it's straight-up HTTP authentication (the kind where a standard
> dialog box pops up in the browser asking for a username and password),
> you can probably access it using something like:
>
> $data = file_get_contents(
> "http://username:password@example.com/path/to/data" );
>
> If it's session-based authentication that was implemented in php or
> some other server-side language, you'll need to POST a login form,
> capture the session identifier (usually a cookie), and pass it back to
> the server with each request.
>
> --
> Chris Snyder
> http://chxo.com/
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20061017/1bee5af1/attachment.html>


More information about the talk mailing list