0

I'm making several cURL requests to a page. After this one POST request, I get this error in my cURL output

* Protocol  https not supported or disabled in libcurl
* Closing connection -1

cURL doesn't even make the request. I can't figure out how to solve this error.

The weird thing is that SSL is enabled for both my CLI and FPM. Seen here http://cl.ly/image/1L062C2h2M2W

I tried making the request to an http:// instead of https://. That didn't change anything. I even tried making sure my server had an SSL, and that didn't change it.

My cURL calls look like this

$fp2 = fopen('cookies/debug.txt', 'a');
fwrite($fp2, "\n $action");
fwrite($fp2, "\n $url");
fwrite($fp2, "\n ".sizeof($data));
fwrite($fp2, "\n ".json_encode($data));
fwrite($fp2, "\n_________________________________________\n");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($action == "POST") curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POSTREDIR, 3);

$fp = fopen('cookies/curl.txt', 'a');
curl_setopt($ch, CURLOPT_STDERR, $fp);

curl_setopt($ch, CURLOPT_COOKIEJAR, $this->strCookie);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $this->strCookie);

    if($header) {
        curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
    }

// Set the request as a POST FIELD for curl.
if($action == "POST") {

    if(in_array("Content-Type:application/x-www-form-urlencoded", $header)) {
        $data = http_build_query($data);
    }

    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}

// Get response from the server.
$res = curl_exec($ch);
fwrite($fp, "\n_________________________________________\n");
fwrite($fp, "\n$action $url\n");

return $res;

and the full debug of the last call is

______________about to try___________________________
POST  https://sellercentral.amazon.com/gp/communication-manager/view-message.html/ref=ag_xx__cmread?ie=UTF8&addnFilter0=rs&arrivalDate=1417064517&clcmResponseTimeSuboptions=uwd&curPage=1&dateExactEnd=&dateExactStart=&dateFilter=7d&isInbox=1&itemsPerPage=20&marketplaceId=ATVPDKIKX0DER&messageId=A3OSG68VXPA9BV&msgIndex=1&otherPartyId=&pageNum=1&replyToEmail=0&searchBoxText=&showFilters=0&sortBy=ArrivalDate&sortOrder=Descending&timestamp=1417070427&totalMsg=1&view=reader

* Protocol  https not supported or disabled in libcurl
* Closing connection -1

The "about to try", is my own debugging. The two ** are the only output from cURL when I try this request.

8
  • are you trying if from localhost or any domain? Commented Nov 27, 2014 at 6:46
  • It's from a rackspace server Commented Nov 27, 2014 at 6:50
  • Note, that other POSTs to https URLs to this domain work fine. It's just this one in particular. In the browser when I monitor this request, it returns a 302 Moved temporarily. That's the only thing that I can think that might be in the way. cl.ly/image/1l3k1w3s2s3v Commented Nov 27, 2014 at 6:51
  • Even i use rackspace, Check if cloudflare is interfering, when i check my phpinfo for curl i find libssh2. maybe it is required Commented Nov 27, 2014 at 6:55
  • Hey i think there is a issue with post request, did you try using the amazon scratchpad, my link works for india mws.amazonservices.in/scratchpad/index.html Commented Nov 27, 2014 at 6:57

1 Answer 1

1

There was a space in front of the "https". The error was saying " https" is not supported.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.