1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: |
<?php $data = array ( 'type' => 'direct', 'userfile[]' => '@c:Apache Server Doc Folderpicture.jpg', 'private' => '0', ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://www.url.com/upload.php"); curl_setopt($curl, CURLOPT_VERBOSE, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl); curl_close($curl); ?> |
And there is a reference for POST JSON here :
http://www.lornajane.net/posts/2011/posting-json-data-with-php-curl