Skip to content

Instantly share code, notes, and snippets.

@viccherubini
Last active August 29, 2015 13:57
Show Gist options
  • Save viccherubini/9605048 to your computer and use it in GitHub Desktop.
Save viccherubini/9605048 to your computer and use it in GitHub Desktop.
PHP cURL oddness
<?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