ResumeAPI / SampleCode /SamplephpCall.php
Vaibhav84's picture
Change
c1e46eb
raw
history blame
880 Bytes
<?php
// API endpoint URL
$url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/";
// Path to the file you want to upload
$file_path = "d:/hug/job_desc_front_end_engineer.pdf";
// Extract the filename from the file path
$file_name = basename($file_path);
// Initialize cURL
$curl = curl_init();
// Set cURL options
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(
'file' => new CURLFile($file_path), // Attach the file
'FileName' => $file_name // Pass the filename parameter
),
));
// Execute the cURL request
$response = curl_exec($curl);
// Check for errors
if (curl_errno($curl)) {
echo 'Error: ' . curl_error($curl);
} else {
// Print response
echo $response;
}
// Close cURL
//php samplephpcall.php
curl_close($curl);
?>