问题1:主机无完全网络权限
解决:客户开放一下URL的访问权限
api.weixin.qq.com
open.weixin.qq.com
并且无DNS解析,所以固定IP,修改hosts文件
问题2:开放后依然不能访问如上URL
解决:经过调试发现,对https的访问会得到如下错误
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in ...php on line 2
确认以下配置也是正确的
- extension=php_openssl.dll
- allow_url_fopen = On
代码需要修改,加入如下参数
<?php
$arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), );
$response = file_get_contents("open.weixin.qq.com?xxxxx", false, stream_context_create($arrContextOptions));
echo $response; ?>
另一个api.weixin.qq.com加了却是错误的