mercredi 26 octobre 2016

Post request to external API with file from laravel app folder using php Curl

Hey can someone help i am sending post api request to external with file from my laravel app file folder which is under my public folder. i am sending pdf file from this folder and getting. file not found error can someone help...

$samplefile = "/var/www/html/laravel_project/public/1476505004.pdf"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://api_upload_usl/api/uploads"); curl_setopt($ch, CURLOPT_POSTFIELDS, array('myFile'=>"@$samplefile",'token'=>$token,'id'=>1)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); curl_close($ch);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire