POST the username and password to the login method
June 8, 2010 4:12 PM Subscribe
How do it "Simply POST the username and password to the login method" (preferbly using PHP)?
I have the instructions below, but I am a bit unclear as to how to do this. I would prefer to send the username and password and forward to another page of my choosing entirely.
Authentication Service
The authentication service is used to establish a session with www.example.com. Once the session has been established it will expire after 30 minutes of inactivity. The session is used to identify requests as a particular user and apply any security appropriately.
Session Login
www.example.com supports the method below of sending the login information to it.
Raw login using the username and password (also available over https).
URL: http(s)://www.example.com
Simply POST the username and password to the login method
Request
POST
<login>
<username>username</username>
<password>password</password>
</login>
I have the instructions below, but I am a bit unclear as to how to do this. I would prefer to send the username and password and forward to another page of my choosing entirely.
Authentication Service
The authentication service is used to establish a session with www.example.com. Once the session has been established it will expire after 30 minutes of inactivity. The session is used to identify requests as a particular user and apply any security appropriately.
Session Login
www.example.com supports the method below of sending the login information to it.
Raw login using the username and password (also available over https).
URL: http(s)://www.example.com
Simply POST the username and password to the login method
Request
POST
<login>
<username>username</username>
<password>password</password>
</login>
maybe something like this?
< form action="http://www.example.com" method="post" />
< input type="text" name=username value="default value" />
< input type="password" name=password value="default value" />
< input type="submit" value="Submit" />
you could also change the input types to hidden etc. post sends the values when asking the server for a webpage. you could fill in the username and password values with php.
posted by kg at 5:18 PM on June 8, 2010
< form action="http://www.example.com" method="post" />
< input type="text" name=username value="default value" />
< input type="password" name=password value="default value" />
< input type="submit" value="Submit" />
you could also change the input types to hidden etc. post sends the values when asking the server for a webpage. you could fill in the username and password values with php.
posted by kg at 5:18 PM on June 8, 2010
kg, that won't work. What that'll look like in the background is this:
username=somevalue&password=someothervalue
posted by jangie at 8:13 PM on June 8, 2010
username=somevalue&password=someothervalue
posted by jangie at 8:13 PM on June 8, 2010
SOAP is a very specific format, that the example given looks nothing like, so you "just" want to use PHP (or similar) to open an HTTP connection to the auth server. You could use curl for this, but I can never remember what all the options for it are meant to be, so would probably just go with file_get_contents:
posted by gregjones at 11:07 PM on June 8, 2010
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => "Content-type: application/xml",
'content' => $xml,
),
));
$result = file_get_contents('http://example.com', false, $context);
where $xml is your username/password chunk. Your session token will be in $result somewhere, I'd imagine.posted by gregjones at 11:07 PM on June 8, 2010
Response by poster: Thanks all. I will give SOAP and curl a try.
posted by kaozity at 5:48 AM on June 9, 2010
posted by kaozity at 5:48 AM on June 9, 2010
« Older Wanted: People who geek out over gorgeous shelving... | In Shakespeare's Hamlet, why doesn't Horatio tell... Newer »
This thread is closed to new comments.
Unless I'm misunderstanding.
posted by artlung at 4:48 PM on June 8, 2010