Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. function request($url, $data)
  2. {
  3.     $url = $_SESSION['instance_url'].$url;
  4.  
  5.     $headers = [
  6.         'Authorization: Bearer '.$_SESSION['access_token'],
  7.         'content-type: text/csv',
  8.     ];
  9.  
  10.  
  11.     $curl = curl_init($url);
  12.     curl_setopt($curl, CURLOPT_HEADER, false);
  13.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  14.     curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  15.     curl_setopt($curl, CURLOPT_PUT, true);
  16.     curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  17.  
  18.     $json_response = curl_exec($curl);
  19.  
  20.     return json_decode($json_response, true);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement