Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // API SERVER INFO
- HTTP/1.1 200 OK
- Cache-Control: no-cache
- Pragma: no-cache
- Content-Type: application/json; charset=utf-8
- Expires: -1
- Server: Microsoft-IIS/7.5
- X-AspNet-Version: 4.0.30319
- X-Powered-By: ASP.NET
- Date: Tue, 19 Jan 2016 11:58:31 GMT
- Content-Length: 566
- // Auth
- BASIC auth - username:password
- // My code:
- $username = 'username';
- $password = 'password';
- $host = 'https://api.some.url';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $host);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $result = curl_exec($ch);
- $info = curl_getinfo($ch);
- curl_close($ch);
- $data = json_decode($result, true);
- print_r($data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement