dsandal

Untitled

Jun 26th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1.     $filename = '0b62857adcb4171659a39d802f9f04c5.png';
  2.     $tmpfile = storage_path('app/public/avatars/' . $filename);
  3.     $filedata = curl_file_create($filename = $tmpfile, $postname = $filename);
  4.     $data = [
  5.         'f' => $filedata,
  6.     ];
  7.     $headers = [
  8.         'X-Requested-With:XMLHttpRequest',
  9.         'Authorization: Bearer 1e28f17a8393844b2d44dbdb7963d3ed',
  10.     ];
  11.     $ch = curl_init();
  12.     curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  13.     curl_setopt($ch, CURLOPT_URL, "https://vtcrm.fru-it.ru/api/tickets/31/files");
  14.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15.     curl_setopt($ch, CURLOPT_VERBOSE, 1);
  16.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  17.     curl_setopt($ch, CURLOPT_HEADER, 1);
  18.     curl_setopt($ch, CURLOPT_POST, 1);
  19.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  20.     $response = curl_exec($ch);
  21.     dd(curl_getinfo($ch), $response);
Advertisement
Add Comment
Please, Sign In to add comment