Zoho Creator postUrl()调用遇内部错误,求排查及SSL验证关闭方法
postUrl() & Skipping SSL Verification Let's tackle your issues one by one—first setting up SSL verification skip, then fixing that frustrating Internal Error.
1. Skipping SSL Verification (Equivalent to verify_peer=0)
The postUrl function in Zoho Deluge is a simplified wrapper and doesn't support directly disabling SSL certificate verification. Instead, you'll need to use the more flexible invokeurl function, which includes an ssl_verify parameter to skip SSL checks.
Replace your postUrl call with this:
// Replace the postUrl line with invokeurl Result = invokeurl [ url: URL type: POST parameters: RequestMap headers: HeaderMap ssl_verify: false // This disables SSL peer verification (verify_peer=0) ];
2. Troubleshooting the Internal Error
An Internal Error usually means the server is hitting an unexpected issue—often due to invalid request data. Let's check the most likely culprits in your code:
a. Wrong Credentials in Base64 Encoding
You're hardcoding "httpLogin:httpPwd" for Base64 encoding, but you defined wbLogin and wbPwd as your actual credentials. This will send invalid auth data to the server, causing errors. Fix it like this:
Base64Encoded = zoho.encryption.base64Encode(wbLogin + ":" + wbPwd); AuthorizationBasic = "Authorization: Basic " + Base64Encoded;
b. Incorrect Date/Time Values
zoho.currentdate.getDay()returns the day of the week (1 = Sunday, 7 = Saturday), not the day of the month (1-31). If the API expects the date's day portion, usezoho.currentdate.getDate()instead.- For hours and minutes, if the API requires two-digit formatting (e.g.,
09instead of9), use string formatting:RequestMap.put("dt", zoho.currentdate.getDate().toString()); RequestMap.put("hr", zoho.currenttime.toString("HH")); // 24-hour format, two digits RequestMap.put("mn", zoho.currenttime.toString("mm")); // Two-digit minutes
c. Invalid Phone Number
You're hardcoding "phone_number" as dest_num—this is a placeholder, not a valid number. Replace it with the actual phone number from your SMSObject:
RequestMap.put("dest_num", SMSObject.dest_num); // Adjust the field name to match your SMS object
d. Debugging for More Clues
Add debug logs to check exactly what you're sending to the server, and what the server returns:
// Log headers and parameters before the request info "Request Headers: " + HeaderMap; info "Request Parameters: " + RequestMap; // After invoking the request, log the full result info "Full Response: " + Result;
The Result from invokeurl will include detailed error messages (if any) that can pinpoint the exact issue.
Final Modified Code Snippet
Here's your code with all the fixes applied:
void SendSMS(SMS SMSObject) { // CONFIGURATION URL = "https://example.com/send_ack.php"; wbLogin = "wbLogin"; wbPwd = "wbPwd"; wbAccount = "wbAccount"; label = "label"; applicationName = "ADR SMS v1.0"; // BASE64 ENCODING - Fixed credentials Base64Encoded = zoho.encryption.base64Encode(wbLogin + ":" + wbPwd); AuthorizationBasic = "Authorization: Basic " + Base64Encoded; // HEADER HeaderMap = Map(); HeaderMap.put("content-type", "application/x-www-form-urlencoded"); HeaderMap.put("Authorization", AuthorizationBasic); // REQUEST - Fixed date/time and phone number RequestMap = Map(); RequestMap.put("compte", wbAccount); RequestMap.put("op", 1); RequestMap.put("type", 0); RequestMap.put("dt", zoho.currentdate.getDate().toString()); RequestMap.put("hr", zoho.currenttime.toString("HH")); RequestMap.put("mn", zoho.currenttime.toString("mm")); RequestMap.put("label", label); RequestMap.put("dest_num", SMSObject.dest_num); // Use actual number from SMSObject RequestMap.put("msg", "ZC Testing"); RequestMap.put("ref", "ZC"); // CALL API with SSL verification disabled Result = invokeurl [ url: URL type: POST parameters: RequestMap headers: HeaderMap ssl_verify: false ]; // DEBUG info info "Full Response: " + Result; }
内容的提问来源于stack exchange,提问作者Rajib Hossain Pavel

