Skip to content

Instantly share code, notes, and snippets.

@demchenkoe
Created March 28, 2014 13:51
Show Gist options
  • Save demchenkoe/9833254 to your computer and use it in GitHub Desktop.
Save demchenkoe/9833254 to your computer and use it in GitHub Desktop.
<?php
$apikey = "changeMe";
$salt = "changeMe";
$url = "http://local.mycallsystems.com/api/callsOnDemand?apikey=".urlencode($apikey)."&checksum=".urlencode(md5($apikey.$salt));
$start = time();
$request =
[
"time" => [
"start" => [
"Y"=> date('Y', $start)*1,
"M"=> date('m', $start)-1,
"D"=> date('d', $start)*1,
"h"=> date('H', $start)*1,
"m"=> date('i', $start)*1,
"s"=> date('s', $start)*1,
"z"=> date('Z', $start)/60
],
],
"numbers" => [
"caller" => "+79179636377",
"grouped_ids" => [ "1" => ["+79376674528"]],
"callCenterNumber" => "+79036103234",
"options" => [
"redial" => 5,
"interval" => 1
]
],
"record" => [
"on" => true
]
];
$data_string = json_encode($request);
$opts = array('http' =>
array(
'method' => 'POST',
'header' =>
"Content-Type: application/json\r\n"
. 'Content-Length: ' . strlen($data_string) . "\r\n",
'content' => $data_string,
'timeout' => 60,
'ignore_errors' => true
)
);
echo $url."\r\n";
print_r($request);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context, -1, 40000);
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment