logging in Apache login window

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Re: logging in Apache login window

Post by swirlee » Sun Aug 31, 2003 11:02 am

franlaw wrote:My problem is how I can make a php program to fill in the login window (from Apache) like a human?


Basically what you'll have to do is use PHP sockets to open a connection to the server and request the page. The server will then send back headers with a challenge, at which point you'll have to send back the username and password. This is not easy, and I won't explain how to do it. Instead, I'll refer you to the spec:

HTTP/1.0 -- 11. Access Authentication

Believe me, it's a charming read. You're going to learn way more about HTTP headers than you ever wanted to. Below are some PHP classes which may help you in dealing with the HTTP angle:

PHPClasses.org search for "HTTP"

You'll have to register to download any of them, but it's worth it. Good luck.

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Post by swirlee » Thu Sep 04, 2003 7:41 pm

franlaw wrote:1) What php commands I can use to establish the connection and request the page?


Use PHP's Sockets functions.

franlaw wrote:2) How can I detect the authentication challenge is received from server? Would it be some system global variable?

3) I believe the php command "header()" can be used to response to the challenge. Is this correct?


Just use the socket functions and do it all in raw mode. All you're doing is sending text to and recieving text from the server. You don't need anything other than sockets. Or one of the prefab classes I mentioned.

franlaw wrote:4) Where can I find information on the message format of response to challenge? All reference I found shows how to trigger the authentication process from the server.


In order to answer this part of the question, I'd just end up going to Google and searching. I suggest that you cut out the middleman and take this step yourself.

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Post by Redcircle » Fri Sep 05, 2003 4:12 pm

one thing you may want make a note of is that if the site you are trying to connect to has any redirects it will probably fail.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests