Forum Moderators: coopster

Message Too Old, No Replies

XML over HTTP response

My code won't get a response from this (seemingly simple) API

         

tayf

10:53 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



Hi fellas,

I'm trying to get the hang of working with this API. The documentation describes it as follows:

Formatting Calls to the API
All API calls are made via HTTP POST to:
[admin.mobiletoolbox.com ] (note the trailing '/')
All methods comprise of a URI method name along with a query string of parameter names for input. Each
method returns an XML document as its HTTP response. The API calls may also be made through HTTPS (recommended).

For each method, the prefix is always the above URL. “Method name” will refer to the API call after the URL. For
example, for the method named “GetStores”, the HTTP POST API call would be:

[admin.mobiletoolbox.com ]

Any required parameters are appended onto the query string. The “GetStores” method requires a “username”
and “password”, so the full call would look like:
[admin.mobiletoolbox.com ]

REMEMBER: All API calls require your username and password. No API method calls will work without your username and password!

I'm a real novice with this stuff but I'm just trying to get some xml responses like the documentation shows when you click on the link. My code is as follows - but it returns absolutely nothing :S.

$query = 'GetStores?username=demo&password=demo123';
$x = curl_init("https://admin.mobiletoolbox.com/MobiletoolboxService.aspx/");
curl_setopt($x, CURLOPT_HEADER, 0);
curl_setopt($x, CURLOPT_POST, 1);
curl_setopt($x, CURLOPT_POSTFIELDS, $query);
curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($x, CURLOPT_REFERER, "http://59.167.208.109/premiericons/mob");
curl_setopt($x, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($x);
curl_close($x);
echo $data;

whoisgregg

11:23 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Note:
Any required parameters are appended onto the query string.

So, even though the documentation says POST API, it's actually a GET. If you send the query string as part of the URL you'll get a response.