Advertisement
Guest User

Curl

a guest
Jun 9th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?
  2.  
  3.     $log = fopen('./log/request.txt', 'w');
  4.  
  5.     $param = array(
  6.         CURLOPT_URL => 'https://example.com/v2/droplets/948',
  7.         CURLOPT_CUSTOMREQUEST => 'DELETE',
  8.         CURLOPT_RETURNTRANSFER => true,
  9.         CURLOPT_HTTPHEADER => array(
  10.             "Authorization: Bearer ...",
  11.             "Content-Type: application/json"
  12.         ),
  13.         CURLOPT_FOLLOWLOCATION => 1,
  14.         CURLOPT_VERBOSE => 3,
  15.         CURLOPT_STDERR => $log,
  16.     );
  17.  
  18.     $ch = curl_init();
  19.  
  20.     curl_setopt_array($ch, $param);
  21.     curl_exec($ch);
  22.  
  23.     $response = curl_exec($ch);
  24.     fclose($log);
  25.     curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement