Last active
August 29, 2015 13:57
-
-
Save viccherubini/9605048 to your computer and use it in GitHub Desktop.
PHP cURL oddness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This fails, but only on staging (DigitalOcean) server. | |
// Works fine on production (Linode) server. | |
// Please ignore bad security practices. | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, 'https://server.com:2143'); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, '<CommandQuery/>'); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
$response = curl_exec($curl); | |
var_dump($response); // false | |
print_r(curl_getinfo($curl)); // Don't event get a valid HTTP response code or content type. | |
// This works just fine on the same staging (DigitalOcean) server. | |
// curl -v -k https://server.com:2143 -d '<CommandQuery/>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment