Skip to content

Instantly share code, notes, and snippets.

@DevotionGeo
Forked from Darkflib/pushstream.php
Last active August 29, 2015 14:20
Show Gist options
  • Save DevotionGeo/d2440442ce22d796da9b to your computer and use it in GitHub Desktop.
Save DevotionGeo/d2440442ce22d796da9b to your computer and use it in GitHub Desktop.
$id='1227feacf41c472e5ee34e20b510a240ad81ea6e';
echo 'id '.$id."\n";
$url = 'http://example.com/activity/pub?id='.$id;
echo 'url '.$url."\n";
$data = array( 'foo' => 'bar' );
$data_json = json_encode($data);
echo $data_json."\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json)));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment