Created
May 28, 2014 08:14
-
-
Save arnaudbreton/eb19bc20262af2a756b5 to your computer and use it in GitHub Desktop.
Talk with the mention's API
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 | |
$url = "https://api.mention.com/api/accounts"; | |
$postValues = array( "name" => "Mon nom trop bien", "email" => "test@test.fr", "password" => "motdepasse@de.fr", "language_code" => "fr", "client" => "feedsens"); | |
$curlHandle = curl_init(); | |
curl_setopt($curlHandle, CURLOPT_URL, $url); | |
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json')); | |
curl_setopt($curlHandle, CURLOPT_POST, true); | |
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, json_encode($postValues)); | |
$result = curl_exec($curlHandle); | |
if (curl_errno($curlHandle)) { | |
print curl_error($curlHandle); | |
} else { | |
curl_close($curlHandle); | |
} | |
echo $result; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment