关于腾讯微博新版php-sdk提示”建立sock连接失败”的解决方法

错误提示:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://open.t.qq.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Fatal error: Uncaught exception 'Exception' with message '建立sock连接失败'

原因:使用fsockopen()需要php_openssl.dll的支持,但服务器并没有加载该dll。

解决方案一:用 curl代替fsockopen

打开opent.php 把185行到241行注释掉,并把244行到291行的注释去掉,(PS:如果不能解决问题 请尝试下面的解决方案)

解决方案二:

此方案需要php.ini文件的修改权限(如果没有权限可以联系服务器管理员或空间运营商)

打开 php.ini 找到

;extension=php_openssl.dll
;extension=php_curl.dll

把前面的分号去掉,重启IIS或APACHE问题解决。