Skip to content

Instantly share code, notes, and snippets.

@mikeknoop
Created October 24, 2012 21:14
Show Gist options
  • Save mikeknoop/3948931 to your computer and use it in GitHub Desktop.
Save mikeknoop/3948931 to your computer and use it in GitHub Desktop.
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
$fields = array('data' => $variable);
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt(CURLOPT_HTTPHEADER, array('Content-Type' => 'application/json'));
curl_setopt(CURLOPT_POST, true);
curl_setopt(CURLOPT_POSTFIELDS, $fields );
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment