improved examples
This commit is contained in:
parent
a70bce09cd
commit
6eb7271d43
5 changed files with 11 additions and 31 deletions
31
auth.php
31
auth.php
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,"http://10.11.25.107/auth_basic.php");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$headers = apache_request_headers();
|
||||
|
||||
if (!isset($headers['Authorization'])) die('Forbidden');
|
||||
|
||||
$headers = array('Authorization: '.$headers['Authorization']);
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$server_output = curl_exec ($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
curl_close ($ch);
|
||||
|
||||
if ($info['http_code']!=200) die('Forbidden');
|
||||
|
||||
include "api.php";
|
||||
|
||||
$api = new SQLSRV_CRUD_API(array(
|
||||
'hostname'=>'(local)',
|
||||
'username'=>'',
|
||||
'password'=>'',
|
||||
'database'=>'xxx',
|
||||
'charset'=>'UTF-8'
|
||||
));
|
||||
$api->executeCommand();
|
||||
|
||||
|
|
@ -9,3 +9,14 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
|||
} else {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
}
|
||||
|
||||
include "api.php";
|
||||
|
||||
$api = new SQLSRV_CRUD_API(array(
|
||||
'hostname'=>'(local)',
|
||||
'username'=>'',
|
||||
'password'=>'',
|
||||
'database'=>'xxx',
|
||||
'charset'=>'UTF-8'
|
||||
));
|
||||
$api->executeCommand();
|
||||
Loading…
Add table
Add a link
Reference in a new issue