Skip to content

Instantly share code, notes, and snippets.

@arnaudbreton
Created May 28, 2014 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnaudbreton/eb19bc20262af2a756b5 to your computer and use it in GitHub Desktop.
Save arnaudbreton/eb19bc20262af2a756b5 to your computer and use it in GitHub Desktop.
Talk with the mention's API
<?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