File size: 1,075 Bytes
c1e46eb
 
 
 
6a3e938
c1e46eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a3e938
c1e46eb
 
6a3e938
 
 
 
 
c1e46eb
 
 
 
 
 
6a3e938
 
c1e46eb
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
// API endpoint URL
$url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/";
// Path to the file you want to upload
$file_path = "data/Java1.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
    ),
));
$start_time = microtime(true);
// Execute the cURL request
$response = curl_exec($curl);
// Measure the end time
$end_time = microtime(true);

// Calculate the total time taken
$total_time = $end_time - $start_time;

// Check for errors
if (curl_errno($curl)) {
    echo 'Error: ' . curl_error($curl);
} else {
    // Print response
    echo $response . " \n";
    echo "Total time: " . $total_time . " seconds\n";
}

// Close cURL
//php samplephpcall.php
curl_close($curl);
?>