Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. $boundary = uniqid();
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL, $url);
  4. curl_setopt($ch, CURLOPT_POST, 1);
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  6. curl_setopt($ch, CURLOPT_HTTPHEADER, Array('Content-Type: multipart/form-data; boundary=' . $boundary));
  7. $post = "\n--$boundary\nContent-Disposition: form-data; name=\"$name\"; filename=\"$filename\"\n\n";
  8. $post .= file_get_contents($dt['url']);
  9. $post .= "\r\n--" . $boundary . "--\r\n";
  10. curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  11. $data = json_decode(curl_exec($ch), true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement