Page 1 of 1

API POST values

Posted: Thu Oct 13, 2005 7:47 pm
by jwalsh
Hi Guys,

I am working with another development team on a cross domain API project. I need to check if a login passes or fails. The API they gave me takes the username and password as post variables, and returns XML output with the data I need, or an error if the login fails.

What I need to do is post the login, and check the results it returns to see if the login passes or fails.

How can I post variables to this page, and be able to parse the returned value? My thoughts are XMLhttpRequest, similar to how you would do an AJAX request.

What's the best solution here?

Josh

Posted: Thu Oct 13, 2005 7:49 pm
by jwalsh
How Ironic that someone else posted this exact problem on the same topic... If I find a solution there, I'll post it here.

Posted: Thu Oct 13, 2005 8:06 pm
by jwalsh
We resolved the issue by switching from POST to GET. then using file_get_contents(), but I would still like to know how to do this using POST, for curiosity.

Josh

Posted: Thu Oct 13, 2005 9:58 pm
by josh
jwalsh wrote:I would still like to know how to do this using POST
The 'easiest' method would be sockets. read up on the http protocol to learn how to make a request

Posted: Thu Oct 13, 2005 10:02 pm
by feyd
sockets? :? curl would be far easier to do it in.. if curl isn't available, then sockets would be next in line to use...

Posted: Thu Oct 13, 2005 10:05 pm
by josh
That's why I put quotes around 'easiest', for most people it is more difficult to install the CURL package then it would be to pick up some basic socket knowledge, plus sockets are just plain cooler :-p (not to mention more portable)