| Server IP : 172.67.187.206 / Your IP : 172.71.28.156 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/csr/admin/api/ |
Upload File : |
<?
$csid=$_GET['csid'];
$url = 'http://api.bopp-obec.info/Students/api/Authen';
$data = array(
"PersonId"=>'3770200413935',
"Password"=>'38j7GX2ah$f4dpk'
);
$url_tea = "http://api.bopp-obec.info/Students/api/Teachers/".$csid;
$token = get_Authenticate($url, $data);
$sch = gat_school_info($url_tea,$token);
echo $sch;
//$obj = json_decode($sch);
//var_dump($obj);
// print_r($obj);
function get_Authenticate($url, $data){
$payload = json_encode( $data );
$ch = curl_init( $url );
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
return $result ;
}
function gat_school_info($url, $token){
$ch = curl_init( $url );
$a = json_decode( $token,true);
$token_txt = $a["token" ];
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $token_txt
));
$data = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $data ;
}
?>