curl, dogeCloud api

master
string1995 5 years ago
parent e8e90d9801
commit b1e2ddc271
  1. 6
      config.example.php
  2. 37
      functions.php
  3. 37
      test/curl.php

@ -4,4 +4,8 @@
$g_db_serverName="Your database server IP or Name";
$g_db_usrName="Your database user name";
$g_db_psswd="Your password";
$g_db_dbName="The main database you select";
$g_db_dbName="The main database you select";
//dogecloud API
$dc_AccessKey = "Your_AccessKey";
$dc_SecretKey = "Your_SecretKey";

@ -505,3 +505,40 @@ newVideo('$id');
}
/****API******/
//fnct for dogecloud API
function api__dogecloud($platform,$vcode,$ip,$AccessKey,$SecretKey){
$url="https://api.dogecloud.com/video/streams.json?platform=$platform&vcode=$vcode&ip=$ip";
$str="/video/streams.json?platform=pch5&vcode=7119902f856c85a0&ip=49.64.195.241"."\n";
$str = hash_hmac("sha1", $str, $SecretKey);
$headerArray =array("Host:api.dogecloud.com","Authorization: TOKEN ".$AccessKey.":".$str);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArray);
$output = curl_exec($ch);
if($errno = curl_errno($ch)) {
$error_message = curl_strerror($errno);
echo "cURL error ({$errno}):\n {$error_message}";
}
curl_close($ch);
return $output;
}

@ -0,0 +1,37 @@
<?php
$AccessKey = "caa81f2271eeeb10";
$SecretKey = "91e74d006107bee0ea9ba99f5e657853";
echo api__dogecloud("pch5","7119902f856c85a0","49.64.195.241",$AccessKey,$SecretKey);
//fnct for dogecloud API
function api__dogecloud($platform,$vcode,$ip,$AccessKey,$SecretKey){
$url="https://api.dogecloud.com/video/streams.json?platform=$platform&vcode=$vcode&ip=$ip";
$str="/video/streams.json?platform=pch5&vcode=7119902f856c85a0&ip=49.64.195.241"."\n";
$str = hash_hmac("sha1", $str, $SecretKey);
$headerArray =array("Host:api.dogecloud.com","Authorization: TOKEN ".$AccessKey.":".$str);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArray);
$output = curl_exec($ch);
if($errno = curl_errno($ch)) {
$error_message = curl_strerror($errno);
echo "cURL error ({$errno}):\n {$error_message}";
}
curl_close($ch);
return $output;
}
Loading…
Cancel
Save