fork download
  1. <?php
  2. // Replace with your actual values
  3. $salesorder_id = '3426332000012137218'; // Replace with your Sales Order ID
  4. $organization_id = '786997251'; // Replace with your Organization ID
  5. $auth_token = 'Zoho-oauthtoken 1000.1076154a590dca42d87defa6c71fbe45.c83e8a70b379cdc876f978cb720377ce'; // Replace with your OAuth token
  6.  
  7. // Zoho Books API URL
  8. $api_url = "https://w...content-available-to-author-only...s.com/books/v3/invoices/fromsalesorder?send=false&salesorder_id={$salesorder_id}";
  9.  
  10. // Parameters
  11. $data = [
  12. 'organization_id' => $organization_id
  13. ];
  14.  
  15. // Initialize cURL
  16. $ch = curl_init();
  17. curl_setopt($ch, CURLOPT_URL, $api_url);
  18. curl_setopt($ch, CURLOPT_POST, true);
  19. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  20. "Authorization: $auth_token",
  21. "Content-Type: application/x-www-form-urlencoded"
  22. ]);
  23. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
  24. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  25.  
  26. // Execute request
  27. $response = curl_exec($ch);
  28.  
  29. // Check for cURL errors
  30. if (curl_errno($ch)) {
  31. echo 'cURL Error: ' . curl_error($ch);
  32. } else {
  33. echo 'Response: ' . $response;
  34. }
  35.  
  36. // Close connection
  37. ?>
  38.  
Success #stdin #stdout 0.04s 26236KB
stdin
Standard input is empty
stdout
cURL Error: Could not resolve host: www.zohoapis.com