How to send payload request using php cURL?

how to send payload request using php cURL?

I try to upload a file to the server where the files are stored for free, and when sending the file, I don’t accept it, and I redirect to the error page, and when I do this from my Interfas, I see how the files are sent in the code inspector

How do I install cURL php for a file server, gets me as if the browser?

Payload Request

------ WebKitFormBoundary0cHZePmuSA0mtcdO

Content-Disposition: form-data; name = "files []"; file name = "vlcsnap-2015-07-17-22h57m13s909.png" Content-Type: image / png

------ WebKitFormBoundary0cHZePmuSA0mtcdO -

$ch = curl_init(); $ch_file = new CURLFile( $tmp_name, $type, $name ); $data = array("files[]"=>$ch_file); curl_setopt($ch, CURLOPT_URL, "http://url_site.com"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); 
+4
source share
1 answer

You can use the @ symbol in front of the file name to download, and curl will download it from your server.

  $ch = curl_init("http://url_site.com"); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, array('files[]' => '@'.$tmp_name)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); 
0
source

All Articles