fork download
  1. <?php
  2. // Path to the PDF file
  3. $pdf_path = 'https://w...content-available-to-author-only...i.com/pdf-test.pdf';
  4.  
  5. // Read and encode the PDF file as base64
  6. $pdf_content = file_get_contents($pdf_path);
  7. $base64_pdf = base64_encode($pdf_content);
  8.  
  9. // Prepare JSON payload
  10. $payload = [
  11. 'arguments' => null,
  12. 'keywordArguments' => [
  13. 'uploaded_pdf' => $base64_pdf
  14. ]
  15. ];
  16. $json_payload = json_encode($payload);
  17.  
  18. // API endpoint
  19. $url = 'https://s...content-available-to-author-only...s.ai/api/executeAgent?deploymentToken=1084d8827b21409a992071edb38cde3c&deploymentId=598d44e12';
  20.  
  21. // Initialize cURL
  22. $ch = curl_init();
  23.  
  24. // Set cURL options
  25. curl_setopt($ch, CURLOPT_URL, $url);
  26. curl_setopt($ch, CURLOPT_POST, true);
  27. curl_setopt($ch, CURLOPT_POSTFIELDS, $json_payload);
  28. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  29. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  30. 'Content-Type: application/json'
  31. ]);
  32.  
  33. // Execute the request
  34. $response = curl_exec($ch);
  35.  
  36. // Check for errors
  37. if (curl_errno($ch)) {
  38. echo 'cURL Error: ' . curl_error($ch);
  39. } else {
  40. // Output the response
  41. echo 'Response: ' . $response;
  42. }
  43.  
  44. // Close cURL
  45. ?>
Success #stdin #stdout #stderr 0.04s 27888KB
stdin
Standard input is empty
stdout
cURL Error: Could not resolve host: solarquote.abacus.ai
stderr
PHP Warning:  file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/R1ZlOA/prog.php on line 6
PHP Warning:  file_get_contents(https://w...content-available-to-author-only...i.com/pdf-test.pdf): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/R1ZlOA/prog.php on line 6