Skip to content

Instantly share code, notes, and snippets.

@sluther
Created November 10, 2012 04:42
Show Gist options
  • Save sluther/4049937 to your computer and use it in GitHub Desktop.
Save sluther/4049937 to your computer and use it in GitHub Desktop.
I DONT GET IT
function send_json_to_node($args) {
$data_string=json_encode($args['postdata']);
$ch = curl_init($args['url']);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch,CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array(
'Content-Type:application/json','Content-Length:'strlen($data_string)));
$result = curl_exec($ch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment