sdleihssirhc — 2010-03-16T17:32:35-04:00 — #1
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?
aliendev — 2010-03-16T17:40:54-04:00 — #2
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.
sdleihssirhc — 2010-03-16T17:45:11-04:00 — #3
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()?
aliendev — 2010-03-16T17:57:15-04:00 — #4
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.
sdleihssirhc — 2010-03-16T19:04:35-04:00 — #5
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?
sk89q — 2010-03-16T20:25:59-04:00 — #6
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.
sdleihssirhc — 2010-03-16T20:42:52-04:00 — #7
That did it, thank you.
(I guess it would have been helpful to mention I was running it on Windows; mea culpa.)