how can i pass one url to the parameter file?
This is my code:
header(‘Access-Control-Allow-Origin:*’);
$headers = apache_request_headers();
$file = “www.accyscloud.com/acs/_lib/file/doc/2006/CSF_TEC.pdf”;
$curl = curl_init();
curl_setopt_array(curl, [
CURLOPT_URL => "https://pdf-to-text-converter.p.rapidapi.com/api/pdf-to-text/convert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=“page”\r\n\r\n1\r\n-----011000010111000001101001–\r\n\r\n",
CURLOPT_HTTPHEADER => [
“X-RapidAPI-Host: pdf-to-text-converter.p.rapidapi.com”,
“X-RapidAPI-Key: 20279164dbmshb8e4669f4336a23p10ab3ejsnd93eb2fcd7e2”,
“content-type: multipart/form-data; boundary=—011000010111000001101001”
],
]);
curl);
curl);
curl_close($curl);
if ($err) {
echo “cURL Error #:” . $err;
} else {
echo $response;
}
Thanks and regards!
Join in the discussion - add comment below:
Hello, you might be confused about the code sample for the PHP. So please refer to this url instead: https://stackoverflow.com/questions/12667797/using-curl-to-upload-post-data-with-files
Hope you can find the answer there as I am currently in a middle of something.