Home  >  Article  >  Backend Development  >  微信开发不能返回数据的奇怪有关问题

微信开发不能返回数据的奇怪有关问题

WBOY
WBOYOriginal
2016-06-13 11:51:18920browse

微信开发不能返回数据的奇怪问题

本帖最后由 programmer_wei 于 2014-03-16 00:46:52 编辑 先上代码:
<br />                //获取td栏的代码<br />            	$regex = "/<td  Height=\"30\">([\s\S]*?)<\/td>/";<br />                $str = file_get_contents('http://www.zh818.com/get/quanguo-jg/');<br />                $matches = array();<br />                preg_match_all($regex, $str, $matches);<br />                echo "\n";<br />                <br />            	//获得网址  <br />                $href ='/<a .*?href="(.*?)".*?>/is';<br />                $href_single = array(); <br />                if(preg_match($href, $matches[0][1], $href_single))<br />               <br />                //根据获得的网址获取表格信息     <br />                $regex = '/<table border="1" width="100%">.*([\d\.]+?).*<\/table>/sU';<br />                $str = file_get_contents($href_single[1]);<br />                $matches = array();   <br />                if(preg_match($regex, $str, $matches))<br />                $result = $this->transmitText($object, $matches);<br />

[size=13px]我要实现的功能是微信手机端用户发送请求,服务器通过在一个网站上的html代码中使用正则表达式获取指定信息,然后通过微信接口返回给用户,但是现在当微信端用户发出请求后并不能收到返回的信息,本来以为是不是因为服务器连接到相应网站抽取信息超时引起的,但是当我把代码倒数第四行的$href_single[1]直接改为http网址时,经过测试微信手机端又可以接收到返回信息了,但是$href_single[1]里面的内容实际上就是一个http网址啊,他们格式都是一样的,这到底是怎么回事呢?[/size]

------解决方案--------------------
SAE 不能使用 file_get_contents 函数
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn