Browse Source

improved examples

Maurits van der Schee 8 years ago
parent
commit
6eb7271d43
5 changed files with 11 additions and 31 deletions
  1. 0
    31
      auth.php
  2. 11
    0
      examples/auth.php
  3. 0
    0
      extras/core.php
  4. 0
    0
      lib/php_crud_api_transform.js
  5. 0
    0
      lib/php_crud_api_transform.php

+ 0
- 31
auth.php View File

@@ -1,31 +0,0 @@
1
-<?php
2
-
3
-$ch = curl_init();
4
-curl_setopt($ch, CURLOPT_URL,"http://10.11.25.107/auth_basic.php");
5
-curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
6
-
7
-$headers = apache_request_headers();
8
-
9
-if (!isset($headers['Authorization'])) die('Forbidden');
10
-
11
-$headers = array('Authorization: '.$headers['Authorization']);
12
-
13
-curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
14
-
15
-$server_output = curl_exec ($ch);
16
-$info = curl_getinfo($ch);
17
-curl_close ($ch);
18
-
19
-if ($info['http_code']!=200) die('Forbidden');
20
-
21
-include "api.php";
22
-
23
-$api = new SQLSRV_CRUD_API(array(
24
-  'hostname'=>'(local)',
25
-  'username'=>'',
26
-  'password'=>'',
27
-  'database'=>'xxx',
28
-  'charset'=>'UTF-8'
29
-));
30
-$api->executeCommand();
31
-

auth_example.php → examples/auth.php View File

@@ -9,3 +9,14 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
9 9
 } else {
10 10
     header('HTTP/1.0 403 Forbidden');
11 11
 }
12
+
13
+include "api.php";
14
+
15
+$api = new SQLSRV_CRUD_API(array(
16
+		'hostname'=>'(local)',
17
+		'username'=>'',
18
+		'password'=>'',
19
+		'database'=>'xxx',
20
+		'charset'=>'UTF-8'
21
+));
22
+$api->executeCommand();

core.php → extras/core.php View File


php_crud_api_transform.js → lib/php_crud_api_transform.js View File


php_crud_api_transform.php → lib/php_crud_api_transform.php View File


Loading…
Cancel
Save