Created
April 6, 2011 17:22
-
-
Save esperanca/906088 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PHP example | |
// create a new cURL resource | |
$ch = curl_init(); | |
// set URL and other appropriate options | |
curl_setopt($ch, CURLOPT_URL, "https://demo.socialcast.com/api/messages.xml"); | |
curl_setopt($ch, CURLOPT_HEADER, FALSE); | |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "message[title]=trying%20out%20the%20api&message[body]=hello"); | |
curl_setopt($ch, CURLOPT_USERPWD, "emily@socialcast.com:demo"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
// grab URL and pass it to the browser | |
$api_return = curl_exec($ch); | |
echo $api_return; | |
// close cURL resource, and free up system resources | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment