<?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>NeatCN(NeatStudio工作室) &#187; linezing</title>
	<atom:link href="http://www.neatcn.com/tags/linezing/feed" rel="self" type="application/rss+xml" />
	<link>http://www.neatcn.com</link>
	<description>NeatStudio工作室</description>
	<lastBuildDate>Fri, 09 Dec 2011 13:07:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>采用 CURL登录量子统计(二)</title>
		<link>http://www.neatcn.com/show-23-1.shtml</link>
		<comments>http://www.neatcn.com/show-23-1.shtml#comments</comments>
		<pubDate>Mon, 15 Mar 2010 00:51:28 +0000</pubDate>
		<dc:creator>膘叔</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP开发]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[linezing]]></category>

		<guid isPermaLink="false">http://www.neatcn.com/?p=23</guid>
		<description><![CDATA[本文就全是代码了。。。 $cookiefile = tempnam( './log/' , 'cookie' );//设定cookie文件的路径 。 $ch = curl_init(); $header[]="Content-Type: application/x-www-form-urlencoded"; curl_setopt($ch, CURLOPT_URL, 'http://www.linezing.com/login.php'); //登录地址 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //发送header ，其实这个header可以不发送 curl_setopt($ch, CURLOPT_POST, 1); //这是POST数据 curl_setopt($ch, CURLOPT_POSTFIELDS, 'referer=&#038;webname=index&#038;username=用户名&#038;password=密码&#038;submit=%E7%99%BB%E5%BD%95');//http_build_query( $postData)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //这个是代表curl_exec后取返回成字符串，而不是象WEB一样跳转 curl_setopt($ch, CURLOPT_HEADER, 0); //curl返回的时候，默认都是带有header信息的，所以这里设为0，代表返回的时候不要header信息 curl_setopt($ch, &#8230; <a href="http://www.neatcn.com/show-23-1.shtml">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>本文就全是代码了。。。</p>
<pre class="brush:php">
$cookiefile = tempnam( './log/' , 'cookie' );//设定cookie文件的路径 。
$ch = curl_init();
$header[]="Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_URL, 'http://www.linezing.com/login.php');  //登录地址
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);  //发送header ，其实这个header可以不发送
curl_setopt($ch, CURLOPT_POST, 1);  //这是POST数据
curl_setopt($ch, CURLOPT_POSTFIELDS, 'referer=&#038;webname=index&#038;username=用户名&#038;password=密码&#038;submit=%E7%99%BB%E5%BD%95');//http_build_query( $postData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  //这个是代表curl_exec后取返回成字符串，而不是象WEB一样跳转
curl_setopt($ch, CURLOPT_HEADER, 0);  //curl返回的时候，默认都是带有header信息的，所以这里设为0，代表返回的时候不要header信息
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); //这是在用sniff抓包的时候发现用了gzip,deflate的encoding，
curl_setopt($ch, CURLOPT_REFERER, 'http://www.linezing.com/');//记录来源的Referer
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookiefile);
curl_exec($ch);  //我这里并没有取返回值，主要是把cookie记录下来

curl_setopt($ch, CURLOPT_URL, 'http://www.linezing.com/router.php');  //登录后跳转的网址
//curl_setopt($ch, CURLOPT_COOKIEFILE,$cookiefile); 原先我在这里也记录cookie了，但事实上，我这样做之后，反而会把第一次登录时的cookie覆盖了。。。郁闷
//curl_setopt($ch, CURLOPT_COOKIEJAR,$cookiefile);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.linezing.com/');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION,1);
$res = curl_exec($ch);  

curl_setopt($ch, CURLOPT_URL, 'http://tongji.linezing.com/welcome.html');  //welcome页还会再判断是否登录，如果没有登录，会是一段JS跳到www.linezing.com
//curl_setopt($ch, CURLOPT_COOKIEFILE,$cookiefile);
//curl_setopt($ch, CURLOPT_COOKIEJAR,$cookiefile);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.linezing.com/');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION,1);
curl_exec($ch);  

curl_setopt($ch, CURLOPT_URL, 'http://tongji.linezing.com/mystat.html');
curl_setopt($ch, CURLOPT_COOKIEFILE,$cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR,$cookiefile);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION,1);
$res = curl_exec($ch);  //这里获取返回值，我是想看一下是不是正确。。。
curl_close($ch);
echo htmlSpecialChars( $res );
</pre>
<p>因为是临时写的代码，所以没有封装，但也算是尽量做了注释。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatcn.com/show-23-1.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>采用CURL登录量子统计(一)</title>
		<link>http://www.neatcn.com/show-21-1.shtml</link>
		<comments>http://www.neatcn.com/show-21-1.shtml#comments</comments>
		<pubDate>Sat, 13 Mar 2010 15:07:32 +0000</pubDate>
		<dc:creator>膘叔</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP开发]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[linezing]]></category>

		<guid isPermaLink="false">http://www.neatcn.com/?p=21</guid>
		<description><![CDATA[我自己的站点用的是量子统计，所以对于量子统计就需要有更多的研究和学习。 我想的是，如果我能够通过手机，每天在自己的某个指定页面，就能够看到朋友们过来时的关键字或者搜索引擎关键字等。我就可以利用他们有针对性的对网站进行优化？也可以随时关注网站的流量等信息了。 于是，想到什么就做什么，我直接用snoopy类开始尝试提交post数据，提交后取后返回值 ，并同时打开http://tongji.linezing.com/mystat.html页面（这是一个汇总页），但结果都是提示我需要登录。 如此反复尝试多次，也尝试用curl进行登录，但都是一直失败。最后我不得不祭起抓包利器：smartsniff，这是一个小工具，但是他的抓包功能很强。于是我对我的行为开始抓包，从登录直到显示mystat.html页面，结果却发现，从登录开始，到显示mystat.html页面，一共抓了四次包，他们分别是： http://www.linezing.com/login.php 登录提交页，POST提交 http://www.linezing.com/router.php GET方式 http://tongji.linezing.com/welcome.html GET方式 http://tongji.linezing.com/mystat.html GET方式 其实我觉得奇怪的是，这四个页面是在同一台机器上，而且主机名却是bbs.linezing.com，好妖异。 不过，既然分析了抓包数据，得到这四个页面，那么剩下的就开始写代码了，欲知后事如何，请看周一的代码分析（其实是因为代码在单位的电脑上，在家里地无法更新而己），敬请关注。]]></description>
			<content:encoded><![CDATA[<p>我自己的站点用的是量子统计，所以对于量子统计就需要有更多的研究和学习。<br />
我想的是，如果我能够通过手机，每天在自己的某个指定页面，就能够看到朋友们过来时的关键字或者搜索引擎关键字等。我就可以利用他们有针对性的对网站进行优化？也可以随时关注网站的流量等信息了。</p>
<p>于是，想到什么就做什么，我直接用snoopy类开始尝试提交post数据，提交后取后返回值 ，并同时打开http://tongji.linezing.com/mystat.html页面（这是一个汇总页），但结果都是提示我需要登录。</p>
<p>如此反复尝试多次，也尝试用curl进行登录，但都是一直失败。最后我不得不祭起抓包利器：smartsniff，这是一个小工具，但是他的抓包功能很强。于是我对我的行为开始抓包，从登录直到显示mystat.html页面，结果却发现，从登录开始，到显示mystat.html页面，一共抓了四次包，他们分别是：</p>
<blockquote>
<ol>
<li>http://www.linezing.com/login.php 登录提交页，POST提交</li>
<li>http://www.linezing.com/router.php GET方式</li>
<li>http://tongji.linezing.com/welcome.html GET方式</li>
<li>http://tongji.linezing.com/mystat.html GET方式</li>
</ol>
</blockquote>
<p>其实我觉得奇怪的是，这四个页面是在同一台机器上，而且主机名却是bbs.linezing.com，好妖异。</p>
<p>不过，既然分析了抓包数据，得到这四个页面，那么剩下的就开始写代码了，欲知后事如何，请看周一的代码分析（其实是因为代码在单位的电脑上，在家里地无法更新而己），敬请关注。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatcn.com/show-21-1.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

