LTech
LTech

Reputation: 1761

how to use GET to obtain info from a URL

I'm a php programmer but I'm new to APIs. I would like to run a mysql query to get info from an XML document from madmimi.com. documentation from madmimi.com says GET http://madmimi.com/audience_lists/lists.xml will return the data I need. I've created a php file and connected to their API using

require(dirname(FILE) . '/MadMimi.class.php');

$mailer = new MadMimi('username', 'password');

but I don't understand how to use GET to connect to the URL and display the XML info? What do I need to do?

Upvotes: 2

Views: 524

Answers (2)

Caleuanhopkins
Caleuanhopkins

Reputation: 175

You can use curl to get the response from the 3rd party api. Have a look at this answer:

https://stackoverflow.com/a/5159513/1369567

Based upon the code in answer given at that link, you may need to the code to match your request. E.g:

/* Script URL */
$url = 'http://madmimi.com/audience_lists/lists.xml';

/* $_GET Parameters to Send */
$params = array('username' => '*your api username*', 'password' => '*your api password*');

Upvotes: 0

vanadium23
vanadium23

Reputation: 3586

All http api interaction is hidden to you behind their library. You can use it's methods to grab objects, like this to lists:

$mailer->Lists();

There is no complete documentation, but you can read raw code to search urls, described in API for finding appreciated methods.

Upvotes: 1

Related Questions