<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>竹枝 &#187; cURL</title>
	<atom:link href="http://blog.anyshpm.com/tag/curl/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.anyshpm.com</link>
	<description>S &#38; H / M</description>
	<lastBuildDate>Wed, 21 Dec 2011 14:14:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.anyshpm.com/?pushpress=hub'/>
		<item>
		<title>urlencode</title>
		<link>http://blog.anyshpm.com/2009/08/31/urlencode.html</link>
		<comments>http://blog.anyshpm.com/2009/08/31/urlencode.html#comments</comments>
		<pubDate>Mon, 31 Aug 2009 02:24:35 +0000</pubDate>
		<dc:creator>anyshpm</dc:creator>
				<category><![CDATA[旅程]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[fsockopen]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.anyshpm.com/?p=603</guid>
		<description><![CDATA[[想做课表]以前想做一个学校的课表查询系统，通过小偷方式抓取学校教务处网站上的课表，可一直没有成功。现在，又开学了，看了看以前的代码，重新写了一遍，还是不行，怎么回事呢？ [原理]PHP并没有提供发出http请求的功能，只能使用cURL或用fsockopen模拟http请求。学校教务处的课表查询系统使用.NET写的，里面有一些验证机制，比如隐藏的__VIEWSTATE。 [郁闷]我将这些隐藏数据和其他的表单里的数据一起用fsockopen发送，得到的结果却是“此页的状态信息无效，可能已损坏”。上次也是遇到这样的问题，有同学用asp.net做却很正常。 [解决]上网查了别人写的一些代码，发现别人都会用对POST数据进行url编码，恍然大悟，修改自己的代码后，结果正常。 [总结]看来自己对http协议还是很不熟悉，以前就一直怀疑POST的数据有问题，就是没想到还要编码。学习学习…… 相关文章:codeigniter无显示 (0)开源 (0)记 (1)优秀项目介绍：PHPPowerPoint (2)“真实数据”…… (2)]]></description>
			<content:encoded><![CDATA[<p><strong>[想做课表]</strong>以前想做一个学校的课表查询系统，通过小偷方式抓取学校教务处网站上的课表，可一直没有成功。现在，又开学了，看了看以前的代码，重新写了一遍，还是不行，怎么回事呢？</p>
<p><strong>[原理]</strong>PHP并没有提供发出http请求的功能，只能使用cURL或用fsockopen模拟http请求。学校教务处的课表查询系统使用.NET写的，里面有一些验证机制，比如隐藏的__VIEWSTATE。</p>
<p><strong>[郁闷]</strong>我将这些隐藏数据和其他的表单里的数据一起用fsockopen发送，得到的结果却是“此页的状态信息无效，可能已损坏”。上次也是遇到这样的问题，有同学用asp.net做却很正常。</p>
<p><strong>[解决]</strong>上网查了别人写的一些代码，发现别人都会用对POST数据进行url编码，恍然大悟，修改自己的代码后，结果正常。</p>
<p><strong>[总结]</strong>看来自己对http协议还是很不熟悉，以前就一直怀疑POST的数据有问题，就是没想到还要编码。学习学习……</p>
<h3  class="related_post_title">相关文章:</h3><ul class="related_post"><li><a href="http://blog.anyshpm.com/2010/05/26/no-libmysql-codeigniter.html" title="codeigniter无显示">codeigniter无显示</a> (0)</li><li><a href="http://blog.anyshpm.com/2009/11/01/%e5%bc%80%e6%ba%90.html" title="开源">开源</a> (0)</li><li><a href="http://blog.anyshpm.com/2009/07/16/%e8%ae%b0.html" title="记">记</a> (1)</li><li><a href="http://blog.anyshpm.com/2009/06/01/%e4%bc%98%e7%a7%80%e9%a1%b9%e7%9b%ae%e4%bb%8b%e7%bb%8d%ef%bc%9aphppowerpoint.html" title="优秀项目介绍：PHPPowerPoint">优秀项目介绍：PHPPowerPoint</a> (2)</li><li><a href="http://blog.anyshpm.com/2009/05/11/%e2%80%9c%e7%9c%9f%e5%ae%9e%e6%95%b0%e6%8d%ae%e2%80%9d%e2%80%a6%e2%80%a6.html" title="“真实数据”……">“真实数据”……</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.anyshpm.com/2009/08/31/urlencode.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

