Discussions
Curl Error: couldn't open file on v1/recruiting/applications/documents
Hi,
I try to upload a pdf file via v1/recruiting/applications/documents and get the error couldn't open file "https://www.domain.com/myfile.pdf" but the URL is correct and working in the browser.
Do you have an idea what could be wrong?
Here is my PHP-Code:
$headers = [
'accept: application/json',
'content-type: multipart/form-data',
'x-company-id: ' . $settingsArr['companyId'],
'authorization: Bearer ' . $settingsArr['accessToken']
];
$postData['file'] = curl_file_create('https://www.domain.com/myfile.pdf', 'application/pdf', myfile.pdf);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $settingsArr['docUrl']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$curlResponse = curl_exec($ch);
$curlError = curl_error($ch);
$curlInfo = curl_getinfo($ch);
curl_close($ch);