using API and simple_xml() in php
So i have a jobs website and want to use careerbuilder.com API. It appears that to make a query to their database i need to use a $_GET.
This means that the XML is returned from navigating to a URL.
I am really not sure how i can do this.
I want to have a search form on my website, when posted i want to build the URL using the input from the form and use simple_xml() to turn the returned XMl into an object and display the results on the page.
The only way i can think of is using javascript to get the values from the form and build the URL then use the XMLHttpRequest() object to send a get and return the XML and use javascript again to parse the XML and display on the page?
But what if javascript is not enabled? How can i make a query?
Really new to APIs any advice would be appreciated.
pr0gr4mm3r posted this at 16:33 — 30th January 2009.
He has: 1,502 posts
Joined: Sep 2006
I would do all the processing on the server-side. Build the URL in PHP based on the form, and then use fsockopen() to request the XML. Finally, use SimpleXML to parse the XML response.
If you can post a sample URL, I can do some sample code.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.