Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. error_reporting(-1);
  3. ini_set('display_errors',true);
  4.  
  5. $StretchIp = "192.168.1.10";
  6. $StretchId = "qwert";
  7. $StretchPath = "/core/appliances";
  8.  
  9.  
  10. $url = "http://" . $StretchIp . $StretchPath;
  11.  
  12. $host = $StretchIp;
  13. $username = "stretch";
  14. $password = $StretchId;
  15.  
  16.  
  17. $header = [
  18.     'Host: ' . $host,
  19.     'Authorization: ' . base64_encode($username . ':' . $password),
  20.     'Content-Type: application/xml'
  21. ];
  22.  
  23. $options = [
  24.     'http'=>[
  25.         'method' => 'GET',
  26.         'header'=>implode("\n",$header)
  27.     ]
  28. ];
  29. $context = stream_context_create($options);
  30.  
  31. $response = file_get_contents($url, false, $context);
  32.  
  33. echo $response;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement