Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.  
  3.   $ch = curl_init();
  4.  
  5.   curl_setopt($ch, CURLOPT_URL, "https://web.spaggiari.eu/rest/v1/auth/login/");
  6.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);//TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it directly.
  7.   curl_setopt($ch, CURLOPT_POST, TRUE);//   TRUE to do a regular HTTP POST. This POST is the normal application/x-www-form-urlencoded kind, most commonly used by HTML forms.
  8.  
  9.   $data = [
  10.     "uid" => "miouser",
  11.     "pass" => "miapassword",
  12.   ];
  13.  
  14.   curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  15.  
  16.   $headers = [
  17.     "User-Agent" =>   "zorro/1.0",
  18.     "Z-Dev-Apikey" => "+zorro+",
  19.     "Content-Type" => "application/json",
  20.   ];
  21.  
  22.   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  23.  
  24.   $response = curl_exec($ch);
  25.   curl_close($ch);
  26.  
  27.   var_dump($response);
  28.  
  29.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement