quocvuongdn

#php: curl file with text param

Nov 10th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. <?php
  2.  
  3. $args = array('name' => 'hehe', 'age' => 20));
  4. $args['file'] = new CurlFile(realpath('download.jpg'), 'image/jpg');
  5. //curl_file_create('download.jpg', 'application/octet-stream', realpath('download.jpg'));
  6.  
  7. curl_setopt($ch, CURLOPT_POST, true);
  8. curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
  9. curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
Advertisement
Add Comment
Please, Sign In to add comment