phpapicurlamazon-mws

Getting internal error with Response Status Code 0 on Amazon Marketplace API Requests


I've downloaded Amazon's Marketplace SDK and I'm trying out one of the samples in the samples dir. However, I'm getting an exception with the following details whenever I try it:

Caught Exception: Internal Error
Response Status Code: 0
Error Code: 
Error Type: 
Request ID: 
XML: RequestId: , ResponseContext: , Timestamp: 
ResponseHeaderMetadata: 

I have got CURL enabled with SSL as well. What am I doing wrong?


Solution

  • This answer is for future reference. For in-depth troubleshooting, see comments on the question.

    The empty response indicates a failed connection to the Amazon server. In this case, HTTP worked fine, but HTTPS did not. As turning off CURLOPT_SSL_VERIFYPEER in the cURL settings solved the issue, it appears that the Amazon server was not using a valid SSL certificate.

    Having CURLOPT_SSL_VERIFYPEER turned on checks if the requested host has a valid certificate and lets cURL return false if it doesn't. When CURLOPT_SSL_VERIFYPEER is off, invalid certificates (e.g., self-signed) are accepted and return the regular response.