Advertisement
Kaiajin

CURL on VULTR

Jun 26th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1.     $query_string = "";
  2.     if ($_REQUEST)
  3.     {
  4.         $kv = array();
  5.         foreach ($_REQUEST as $key => $value)
  6.         {
  7.             $kv[] = stripslashes($key) . "=" . stripslashes($value);
  8.         }
  9.         $query_string = join("&", $kv);
  10.         }
  11.     if (!function_exists('curl_init'))
  12.     {
  13.         die('Sorry cURL is not installed!');
  14.     }
  15.     $url = 'https://api.vultr.com/v1/server/reboot';
  16.     $ch = curl_init();
  17.     curl_setopt($ch, CURLOPT_URL, $url);
  18.     curl_setopt($ch, CURLOPT_POST, count($kv));
  19.     curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
  20.     curl_setopt($ch, CURLOPT_HEADER, FALSE);
  21.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, FALSE);
  22.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  23.     $result = curl_exec($ch);
  24.     curl_close($ch);
  25.     var_dump($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement