API POST values

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

API POST values

Post 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
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post 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.
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post 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
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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...
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post 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)
Post Reply