<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/php-file_get_contents-return-false-html/</link>
<title><![CDATA[PHP中file_get_contents返回false]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[Web开发]]></category>
<pubDate>Tue, 25 Sep 2012 15:19:23 +0000</pubDate> 
<guid>https://www.heckjj.com/php-file_get_contents-return-false-html/</guid> 
<description>
<![CDATA[ 
	<span style="font-family: 微软雅黑;">php的file_get_contents获取不了QQ互联接口的返回值，晚上在用QQ的Authentication做用户登录，用QQ返回的code获取access_token的时候用<br/><br/> $response = file_get_contents($token_url);<br/>var_dump($response); // output false <br/>结果却是false，直接把$token_url，拷贝到浏览器里，却能显示出access_token值来。<br/><br/>一开始怀疑是不是服务器不能用file_get_contents，就用file_get_contents(http://www.hecks.tk/);<br/>结果能显示出我博客的html代码来。<br/><br/>搜索该问题也没有找到答案，只好改用curl。<br/>而且php的allow_url_fopen是开的“allow_url_fopen:On”<br/><br/>$ch = curl_init();<br/>$timeout = 5; <br/>curl_setopt ($ch, CURLOPT_URL, $token_url);<br/>curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); <br/>curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);<br/>$response = curl_exec($ch);<br/>curl_close($ch);<br/><br/>有哪位朋友知道的麻烦给指点下。<br/>最后在IT问答网解决了，<a href="http://www.31ask.com/q-94.html" target="_blank">PHP中file_get_contents总是返回false？</a><br/></span><br/>Tags - <a href="https://www.heckjj.com/tags/php/" rel="tag">php</a> , <a href="https://www.heckjj.com/tags/file_get_content/" rel="tag">file get content</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/php-file_get_contents-return-false-html/#blogcomment</link>
<title><![CDATA[[评论] PHP中file_get_contents返回false]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/php-file_get_contents-return-false-html/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>