Last active
December 4, 2017 19:14
-
-
Save naltun/e319b9543835b4875fd05278e7449836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -k --user username:password -H "Accept: application/json" https://mylovely.url.io/api/vms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 <?php | |
16 // begin working with cURL | |
17 $ch = curl_init(); | |
18 curl_setopt_array( | |
19 $ch, | |
20 array( | |
21 CURLOPT_HTTPHEADER => array('Accept: application/json'), | |
22 CURLOPT_URL => 'https://mylovely.url.io/api/vms', | |
23 CURLOPT_USERPWD => 'username:password', | |
24 CURLOPT_RETURNTRANSFER => 1 | |
25 ) | |
26 ); | |
27 | |
28 $encoded_json = curl_exec($ch); | |
29 curl_close($ch); | |
30 | |
31 $decoded_json = json_decode($encoded_json, true); | |
32 $vm_data = $decoded_json; | |
33 | |
34 var_dump($vm_data); | |
35 ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment