2013年5月11日土曜日

HTTPS を file_get_contents で開く

HTTPS がサポートされるのは、openssl 拡張モジュールが有効な場合のみです。

php.ini
extension=php_openssl.dll

phpinfo();
Registered PHP Streams
php, file, data, http, ftp, compress.zlib, https, ftps


openssl 拡張モジュール有効後、file_get_contents利用が可能
file_get_contents('https://search.twitter.com/search.json?q=%40twitterapi%20-via');


また、Apache のSSL対応が必要です。
httpd-2.2.22-win32-x86-no_ssl.msi ではなく
httpd-2.2.22-win32-x86-openssl-0.9.8t.msi です。

http://jaist.dl.sourceforge.net/project/apachehttp.mirror/

0 件のコメント: