Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2. $curl = curl_init();
  3.  
  4. curl_setopt_array($curl, array(
  5.   CURLOPT_URL => "https://app.userengage.com/api/public/users/",
  6.   CURLOPT_RETURNTRANSFER => true,
  7.   CURLOPT_ENCODING => "",
  8.   CURLOPT_MAXREDIRS => 10,
  9.   CURLOPT_TIMEOUT => 30,
  10.   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  11.   CURLOPT_CUSTOMREQUEST => "POST",
  12.   CURLOPT_POSTFIELDS => "{'email': 'myemail@mydomain.com','first_name': 'John',  'last_name': 'Doe'}",
  13.   CURLOPT_HTTPHEADER => array(
  14.     "authorization: Token <bug53ggTj9NQHtlQiyrzLf2LXadurwIb5TfFMEXU6FC9E9KH2m45AQcCEW4fBIqr>",
  15.     "content-type: application/json"
  16.   ),
  17. ));
  18.  
  19. $response = curl_exec($curl);
  20. $err = curl_error($curl);
  21.  
  22. curl_close($curl);
  23.  
  24. if ($err) {
  25.   echo "cURL Error #:" . $err;
  26. } else {
  27.   echo $response;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement