Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $boundary = uniqid();
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, Array('Content-Type: multipart/form-data; boundary=' . $boundary));
- $post = "\n--$boundary\nContent-Disposition: form-data; name=\"$name\"; filename=\"$filename\"\n\n";
- $post .= file_get_contents($dt['url']);
- $post .= "\r\n--" . $boundary . "--\r\n";
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- $data = json_decode(curl_exec($ch), true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement