I have tried to convert the curl command from https://incarnate.github.io/curl-to-php/ URL. but they are not giving me proper php code for that. Can you please help out.
curl -i -F account_id=12345 -F authhash=BKPda_T497AX4EjBsk3ttw9OcOzk -F [email protected] https://url/upload
I tried this code to convert into php code. but not getting proper output.
$cmd = "curl -i -F
account_id=12345 -F
authhash=BKPda_T497AX4EjBsk3ttw9OcOzk -F
[email protected]
https://url/upload";
exec($cmd,$result);
To summarize the comments:
curl -i -F account_id=12345 -F authhash=BKPda_T497AX4EjBsk3ttw9OcOzk -F [email protected] https://url/upload
is going to be
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://url/upload");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array(
'account_id' => '12345',
'authhash' => 'BKPda_T497AX4EjBsk3ttw9OcOzk',
'audioFile' => new CURLFile('CasioVoice.wav')));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
And then you may have to fight with https, depending on the server's certification. If you need that, CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST are some options to look into, but let's hope you will not need them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With