Reputation: 191
I wish to issue the following curl request using php-curl:
curl "http://www.example.com/" -F "[email protected]"
How do I need to set this up in PHP (using curl_init, _setopt, etc.), assuming foo.ext
lives on the machine from which I'm issuing the request?
Upvotes: 3
Views: 2969
Reputation: 360632
you'd use
curl_setopt($curl_handle, CURLOPT_POST, TRUE);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array('file' => '@foo.ext'));
plus whatever options you need. Relevant docs here: http://php.net/curl_setopt
Upvotes: 5