Skip to content

Instantly share code, notes, and snippets.

@taf2
Created February 23, 2016 15:04
Show Gist options
  • Select an option

  • Save taf2/22dc45f2da38c824f4f8 to your computer and use it in GitHub Desktop.

Select an option

Save taf2/22dc45f2da38c824f4f8 to your computer and use it in GitHub Desktop.
<?php
$key = $_ENV['key'];
$sec = $_ENV['sec'];
$account = $_ENV['account'];
$post_request = array(
"post_uri" => "https://api.calltrackingmetrics.com/api/v1/accounts/$account/webhooks"
);
$fieldsSet = array(
"weburl" => "http://requestb.in/1m6lcos1",
"position" => "end"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, "$key:$sec");
curl_setopt($ch, CURLOPT_URL, $post_request['post_uri']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsSet);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
$data = json_decode($response);
var_dump($data);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment