I have an order form that goes to UPS and gets various prices for different shipping options. Here's the basic code that I use to do that:
$xml = arbitrary_xml_building_function();
$stream_params = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $xml
$ctx = stream_context_create($stream_params);
$fp = fopen('https://wwwcie.ups.com/ups.app/xml/Rate', 'r', false, $ctx);
$response = stream_get_contents($fp);
$response = simplexml_load_string($response);
This works on the actual server, which is using PHP 5.2.13, but I've recently updated my development computer to PHP 5.3.2 and I get the following error:
Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
Did I leave something out when I configured PHP?
Look at your php.ini and see if the 'openssl' extension is enabled or not.
If it is disabled (commented with a semi-colon), enable it then restart Apache.
I found this line in my php.ini file:
I took out the semi-colon, stopped Apache, then started it. But the same warning shows up. Is there some way to verify that the extension was, in fact, enabled, perhaps in phpinfo()?
Yes, phpinfo() will have it. Open the info page and look for a big heading saying "openssl".
On my server, openssl also appears under the curl heading.
No openssl and no curl. I searched the page for "openssl" and only found these two references to it, under "Phar":
OpenSSL Support: disabled (install ext/openssl)
I looked in the "ext" folder of php, and found php_openssl.dll right where it should be. The ini file definitely has the appropriate line un-commented. Is it possible I'm missing certain other files?
If you start PHP from the command line, it will show you errors that would otherwise not appear if you started Apache as a service.
That did it, thank you.
(I guess it would have been helpful to mention I was running it on Windows; mea culpa.)