<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>骏马奔腾</title>
	<link>http://liminjun.cn</link>
	<description>天马奔，恋君轩，駷跃惊矫浮云翻</description>
	<pubDate>Mon, 31 Aug 2009 03:42:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>老LEE博客谢幕</title>
		<link>http://liminjun.cn/?p=211</link>
		<comments>http://liminjun.cn/?p=211#comments</comments>
		<pubDate>Mon, 31 Aug 2009 03:42:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=211</guid>
		<description><![CDATA[骏儿明天将正式就读好日子幼儿园，未来博客将记录宝宝的成长生活，不会写字前由爸爸妈妈代劳，会打字后，自己写博客。老李即日将更换博客的风格。
]]></description>
			<content:encoded><![CDATA[<p>骏儿明天将正式就读好日子幼儿园，未来博客将记录宝宝的成长生活，不会写字前由爸爸妈妈代劳，会打字后，自己写博客。老李即日将更换博客的风格。</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=211</wfw:commentRss>
		</item>
		<item>
		<title>比较伤脑筋的游戏</title>
		<link>http://liminjun.cn/?p=209</link>
		<comments>http://liminjun.cn/?p=209#comments</comments>
		<pubDate>Wed, 05 Aug 2009 12:10:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=209</guid>
		<description><![CDATA[http://games.qq.com/images/mini/2007/20070816dongnao/1.swf
有点头昏，玩的
]]></description>
			<content:encoded><![CDATA[<p><u><font color="#800080"><a href="http://games.qq.com/images/mini/2007/20070816dongnao/1.swf">http://games.qq.com/images/mini/2007/20070816dongnao/1.swf</a></font></u></p>
<p>有点头昏，玩的<a href="http://games.qq.com/images/mini/2007/20070816dongnao/1.swf"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=209</wfw:commentRss>
		</item>
		<item>
		<title>悲观</title>
		<link>http://liminjun.cn/?p=208</link>
		<comments>http://liminjun.cn/?p=208#comments</comments>
		<pubDate>Wed, 05 Aug 2009 02:56:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=208</guid>
		<description><![CDATA[阳光灿烂的日子，我怀念那种感觉；生活的压力，让灿烂变成了烈日，我亦变成在烈日下低头流汗的人。一个悲观的人，总会从失落的角度去看待问题，能够看的到得未来，显然并不精彩。悄然，已至而立。悄然一蹉跎，不知又会是多少年。
]]></description>
			<content:encoded><![CDATA[<p>阳光灿烂的日子，我怀念那种感觉；生活的压力，让灿烂变成了烈日，我亦变成在烈日下低头流汗的人。一个悲观的人，总会从失落的角度去看待问题，能够看的到得未来，显然并不精彩。悄然，已至而立。悄然一蹉跎，不知又会是多少年。</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=208</wfw:commentRss>
		</item>
		<item>
		<title>PHP抓取网页内容汇总</title>
		<link>http://liminjun.cn/?p=207</link>
		<comments>http://liminjun.cn/?p=207#comments</comments>
		<pubDate>Tue, 04 Aug 2009 10:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=207</guid>
		<description><![CDATA[①、使用php获取网页内容
http://hi.baidu.com/quqiufeng/blog/item/7e86fb3f40b598c67d1e7150.html
header(&#8221;Content-type: text/html; charset=utf-8&#8243;);
1、
$xhr = new COM(&#8221;MSXML2.XMLHTTP&#8221;);
$xhr-&#62;open(&#8221;GET&#8221;,&#8221;http://book.yunxiaoge.com/files/article/html/[0-9]+/[0-9]+/&#8221;,$my_book_url,$myBook);
$my_book_txt=$myBook[0];
$file_handle = fopen($my_book_url, &#8220;r&#8221;);//读取文件
unlink(&#8221;test.txt&#8221;);
while (!feof($file_handle)) { //循环到文件结束
    $line = fgets($file_handle); //读取一行文件
    $line1=ereg(&#8221;href=\&#8221;[0-9]+.html&#8221;,$line,$reg); //分析文件内部书的文章页面
       $handle = fopen(&#8221;test.txt&#8221;, &#8216;a&#8217;);
   if ($line1) {
     $my_book_txt_url=$reg[0]; //另外赋值,给抓取分析做准备
   $my_book_txt_url=str_replace(&#8221;href=\&#8221;",&#8221;",$my_book_txt_url);
      $my_book_txt_over_url=&#8221;$my_book_txt$my_book_txt_url&#8221;; //转换为抓取地址
      echo &#8220;$my_book_txt_over_url&#60;/p&#62;&#8221;; //显示工作状态
      $file_handle_txt = fopen($my_book_txt_over_url, &#8220;r&#8221;); //读取转换后的抓取地址
      while (!feof($file_handle_txt)) {
       $line_txt = fgets($file_handle_txt);
       $line1=ereg(&#8221;^&#38;nbsp.+&#8221;,$line_txt,$reg); //根据抓取内容标示抓取
       $my_over_txt=$reg[0];
       $my_over_txt=str_replace(&#8221;&#38;nbsp;&#38;nbsp;&#38;nbsp;&#38;nbsp;&#8221;,&#8221;    &#8220;,$my_over_txt); //过滤字符
       $my_over_txt=str_replace(&#8221;&#60;br /&#62;&#8221;,&#8221;",$my_over_txt);
       $my_over_txt=str_replace(&#8221;&#60;script. language=\&#8221;javascript\&#8221;&#62;&#8221;,&#8221;",$my_over_txt);
       $my_over_txt=str_replace(&#8221;&#38;quot;&#8221;,&#8221;",$my_over_txt);
       [...]]]></description>
			<content:encoded><![CDATA[<p>①、使用php获取网页内容<br />
<a href="http://hi.baidu.com/quqiufeng/blog/item/7e86fb3f40b598c67d1e7150.html">http://hi.baidu.com/quqiufeng/blog/item/7e86fb3f40b598c67d1e7150.html</a><br />
header(&#8221;Content-type: text/html; charset=utf-8&#8243;);<br />
1、<br />
$xhr = new COM(&#8221;MSXML2.XMLHTTP&#8221;);<br />
$xhr-&gt;open(&#8221;GET&#8221;,&#8221;<a href="http://localhost/xxx.php?id=2",false">http://localhost/xxx.php?id=2&#8243;,false</a>);<br />
$xhr-&gt;send();<br />
echo $xhr-&gt;responseText</p>
<p>2、file_get_contents实现<br />
&lt;?php<br />
$url=&#8221;<a href="http://www.blogjava.net/pts">http://www.blogjava.net/pts</a>&#8220;;<br />
echo file_get_contents( $url );<br />
?&gt;</p>
<p>3、fopen()实现<br />
&lt;?<br />
if ($stream = fopen(&#8217;http://www.sohu.com&#8217;, &#8216;r&#8217;)) {<br />
    // print all the page starting at the offset 10<br />
    echo stream_get_contents($stream, -1, 10);<br />
    fclose($stream);<br />
}</p>
<p>if ($stream = fopen(&#8217;http://www.sohu.net&#8217;, &#8216;r&#8217;)) {<br />
    // print the first 5 bytes<br />
    echo stream_get_contents($stream, 5);<br />
    fclose($stream);<br />
}<br />
?&gt;</p>
<p>②、使用php获取网页内容<br />
<a href="http://www.blogjava.net/pts/archive/2007/08/26/99188.html">http://www.blogjava.net/pts/archive/2007/08/26/99188.html</a><br />
简单的做法:<br />
&lt;?php<br />
$url=&#8221;<a href="http://www.blogjava.net/pts">http://www.blogjava.net/pts</a>&#8220;;<br />
echo file_get_contents( $url );<br />
?&gt;<br />
或者:<br />
&lt;?<br />
if ($stream = fopen(&#8217;http://www.sohu.com&#8217;, &#8216;r&#8217;)) {<br />
    // print all the page starting at the offset 10<br />
    echo stream_get_contents($stream, -1, 10);<br />
    fclose($stream);<br />
}</p>
<p>if ($stream = fopen(&#8217;http://www.sohu.net&#8217;, &#8216;r&#8217;)) {<br />
    // print the first 5 bytes<br />
    echo stream_get_contents($stream, 5);<br />
    fclose($stream);<br />
}<br />
?&gt;</p>
<p>③、PHP获取网站内容，保存为TXT文件源码<br />
<a href="http://blog.chinaunix.net/u1/44325/showart_348444.html">http://blog.chinaunix.net/u1/44325/showart_348444.html</a><br />
&lt;?<br />
$my_book_url=&#8217;http://book.yunxiaoge.com/files/article/html/4/4550/index.html&#8217;;<br />
ereg(&#8221;<a href="http://book.yunxiaoge.com/files/article/html/[0-9]+/[0-9]+/",$my_book_url,$myBook">http://book.yunxiaoge.com/files/article/html/[0-9]+/[0-9]+/&#8221;,$my_book_url,$myBook</a>);<br />
$my_book_txt=$myBook[0];<br />
$file_handle = fopen($my_book_url, &#8220;r&#8221;);//读取文件<br />
unlink(&#8221;test.txt&#8221;);<br />
while (!feof($file_handle)) { //循环到文件结束<br />
    $line = fgets($file_handle); //读取一行文件<br />
    $line1=ereg(&#8221;href=\&#8221;[0-9]+.html&#8221;,$line,$reg); //分析文件内部书的文章页面<br />
       $handle = fopen(&#8221;test.txt&#8221;, &#8216;a&#8217;);<br />
   if ($line1) {<br />
     $my_book_txt_url=$reg[0]; //另外赋值,给抓取分析做准备<br />
   $my_book_txt_url=str_replace(&#8221;href=\&#8221;",&#8221;",$my_book_txt_url);<br />
      $my_book_txt_over_url=&#8221;$my_book_txt$my_book_txt_url&#8221;; //转换为抓取地址<br />
      echo &#8220;$my_book_txt_over_url&lt;/p&gt;&#8221;; //显示工作状态<br />
      $file_handle_txt = fopen($my_book_txt_over_url, &#8220;r&#8221;); //读取转换后的抓取地址<br />
      while (!feof($file_handle_txt)) {<br />
       $line_txt = fgets($file_handle_txt);<br />
       $line1=ereg(&#8221;^&amp;nbsp.+&#8221;,$line_txt,$reg); //根据抓取内容标示抓取<br />
       $my_over_txt=$reg[0];<br />
       $my_over_txt=str_replace(&#8221;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#8221;,&#8221;    &#8220;,$my_over_txt); //过滤字符<br />
       $my_over_txt=str_replace(&#8221;&lt;br /&gt;&#8221;,&#8221;",$my_over_txt);<br />
       $my_over_txt=str_replace(&#8221;&lt;script. language=\&#8221;javascript\&#8221;&gt;&#8221;,&#8221;",$my_over_txt);<br />
       $my_over_txt=str_replace(&#8221;&amp;quot;&#8221;,&#8221;",$my_over_txt);<br />
       if ($line1) {<br />
         $handle1=fwrite($handle,&#8221;$my_over_txt\n&#8221;); //写入文件<br />
       }<br />
      }<br />
    }<br />
}<br />
fclose($file_handle_txt);<br />
fclose($handle);<br />
fclose($file_handle); //关闭文件<br />
echo &#8220;完成&lt;/p&gt;&#8221;;<br />
?&gt;</p>
<p>下面是比较嚣张的方法。<br />
这里使用一个名叫Snoopy的类。<br />
先是在这里看到的：<br />
PHP中获取网页内容的Snoopy包<br />
<a href="http://blog.declab.com/read.php/27.htm">http://blog.declab.com/read.php/27.htm</a><br />
然后是Snoopy的官网：<br />
<a href="http://sourceforge.net/projects/snoopy/">http://sourceforge.net/projects/snoopy/</a><br />
这里有一些简单的说明：<br />
代码收藏-Snoopy类及简单的使用方法<br />
<a href="http://blog.passport86.com/?p=161">http://blog.passport86.com/?p=161</a><br />
下载：<a href="http://sourceforge.net/projects/snoopy/">http://sourceforge.net/projects/snoopy/</a></p>
<p>今天才发现这个好东西，赶紧去下载了来看看，是用的parse_url<br />
还是比较习惯curl</p>
<p>snoopy是一个php类，用来模仿web浏览器的功能，它能完成获取网页内容和发送表单的任务。<br />
下面是它的一些特征：<br />
1、方便抓取网页的内容<br />
2、方便抓取网页的文字（去掉HTML代码）<br />
3、方便抓取网页的链接<br />
4、支持代理主机<br />
5、支持基本的用户/密码认证模式<br />
6、支持自定义用户agent,referer,cookies和header内容<br />
7、支持浏览器转向，并能控制转向深度<br />
8、能把网页中的链接扩展成高质量的url（默认）<br />
9、方便提交数据并且获取返回值<br />
10、支持跟踪HTML框架（v0.92增加）<br />
11、支持再转向的时候传递cookies</p>
<p>具体使用请看下载文件中的说明。<br />
&lt;?php<br />
include“Snoopy.class.php“;<br />
$snoopy=newSnoopy;<br />
$snoopy-&gt;fetchform(“http://www.phpx.com/happy/logging.php?action=login“);<br />
print$snoopy-&gt;results;<br />
?&gt;<br />
&lt;?php<br />
include“Snoopy.class.php“;<br />
$snoopy=newSnoopy;<br />
$submit_url=“http://www.phpx.com/happy/logging.php?action=login“;$submit_vars[&#8221;loginmode&#8221;]=“normal“;<br />
$submit_vars[&#8221;styleid&#8221;]=“1“;<br />
$submit_vars[&#8221;cookietime&#8221;]=“315360000“;<br />
$submit_vars[&#8221;loginfield&#8221;]=“username“;<br />
$submit_vars[&#8221;username&#8221;]=“********“;//你的用户名<br />
$submit_vars[&#8221;password&#8221;]=“*******“;//你的密码<br />
$submit_vars[&#8221;questionid&#8221;]=“0“;<br />
$submit_vars[&#8221;answer&#8221;]=“”;<br />
$submit_vars[&#8221;loginsubmit&#8221;]=“提 &amp;nbsp; 交“;<br />
$snoopy-&gt;submit($submit_url,$submit_vars);<br />
print$snoopy-&gt;results;?&gt;</p>
<p>下面是Snoopy的Readme<br />
NAME:</p>
<p>    Snoopy - the PHP net client v1.2.4<br />
  <br />
SYNOPSIS:</p>
<p>    include &#8220;Snoopy.class.php&#8221;;<br />
    $snoopy = new Snoopy;<br />
  <br />
    $snoopy-&gt;fetchtext(&#8221;<a href="http://www.php.net/">http://www.php.net/</a>&#8220;);<br />
    print $snoopy-&gt;results;<br />
  <br />
    $snoopy-&gt;fetchlinks(&#8221;<a href="http://www.phpbuilder.com/">http://www.phpbuilder.com/</a>&#8220;);<br />
    print $snoopy-&gt;results;<br />
  <br />
    $submit_url = &#8220;<a href="http://lnk.ispi.net/texis/scripts/msearch/netsearch.html">http://lnk.ispi.net/texis/scripts/msearch/netsearch.html</a>&#8220;;<br />
  <br />
    $submit_vars[&#8221;q&#8221;] = &#8220;amiga&#8221;;<br />
    $submit_vars[&#8221;submit&#8221;] = &#8220;Search!&#8221;;<br />
    $submit_vars[&#8221;searchhost&#8221;] = &#8220;Altavista&#8221;;<br />
      <br />
    $snoopy-&gt;submit($submit_url,$submit_vars);<br />
    print $snoopy-&gt;results;<br />
  <br />
    $snoopy-&gt;maxframes=5;<br />
    $snoopy-&gt;fetch(&#8221;<a href="http://www.ispi.net/">http://www.ispi.net/</a>&#8220;);<br />
    echo &#8220;&lt;PRE&gt;\n&#8221;;<br />
    echo htmlentities($snoopy-&gt;results[0]);<br />
    echo htmlentities($snoopy-&gt;results[1]);<br />
    echo htmlentities($snoopy-&gt;results[2]);<br />
    echo &#8220;&lt;/PRE&gt;\n&#8221;;</p>
<p>    $snoopy-&gt;fetchform(&#8221;<a href="http://www.altavista.com/">http://www.altavista.com</a>&#8220;);<br />
    print $snoopy-&gt;results;</p>
<p>DESCRIPTION:</p>
<p>    What is Snoopy?<br />
  <br />
    Snoopy is a PHP class that simulates a web browser. It automates the<br />
    task of retrieving web page content and posting forms, for example.</p>
<p>    Some of Snoopy&#8217;s features:<br />
  <br />
    * easily fetch the contents of a web page<br />
    * easily fetch the text from a web page (strip html tags)<br />
    * easily fetch the the links from a web page<br />
    * supports proxy hosts<br />
    * supports basic user/pass authentication<br />
    * supports setting user_agent, referer, cookies and header content<br />
    * supports browser redirects, and controlled depth of redirects<br />
    * expands fetched links to fully qualified URLs (default)<br />
    * easily submit form. data and retrieve the results<br />
    * supports following html frames (added v0.92)<br />
    * supports passing cookies on redirects (added v0.92)<br />
  <br />
  <br />
REQUIREMENTS:</p>
<p>    Snoopy requires PHP with PCRE (Perl Compatible Regular Expressions),<br />
    which should be PHP 3.0.9 and up. For read timeout support, it requires<br />
    PHP 4 Beta 4 or later. Snoopy was developed and tested with PHP 3.0.12.</p>
<p>CLASS METHODS:</p>
<p>    fetch($URI)<br />
    &#8212;&#8212;&#8212;&#8211;<br />
  <br />
    This is the method used for fetching the contents of a web page.<br />
    $URI is the fully qualified URL of the page to fetch.<br />
    The results of the fetch are stored in $this-&gt;results.<br />
    If you are fetching frames, then $this-&gt;results<br />
    contains each frame. fetched in an array.<br />
      <br />
    fetchtext($URI)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;  <br />
  <br />
    This behaves exactly like fetch() except that it only returns<br />
    the text from the page, stripping out html tags and other<br />
    irrelevant data.      </p>
<p>    fetchform($URI)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;  <br />
  <br />
    This behaves exactly like fetch() except that it only returns<br />
    the form. elements from the page, stripping out html tags and other<br />
    irrelevant data.      </p>
<p>    fetchlinks($URI)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>    This behaves exactly like fetch() except that it only returns<br />
    the links from the page. By default, relative links are<br />
    converted to their fully qualified URL form.</p>
<p>    submit($URI,$formvars)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
  <br />
    This submits a form. to the specified $URI. $formvars is an<br />
    array of the form. variables to pass.<br />
      <br />
      <br />
    submittext($URI,$formvars)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>    This behaves exactly like submit() except that it only returns<br />
    the text from the page, stripping out html tags and other<br />
    irrelevant data.      </p>
<p>    submitlinks($URI)<br />
    &#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>    This behaves exactly like submit() except that it only returns<br />
    the links from the page. By default, relative links are<br />
    converted to their fully qualified URL form.<br />
CLASS VARIABLES:    (default value in parenthesis)</p>
<p>    $host            the host to connect to<br />
    $port            the port to connect to<br />
    $proxy_host        the proxy host to use, if any<br />
    $proxy_port        the proxy port to use, if any<br />
    $agent            the user agent to masqerade as (Snoopy v0.1)<br />
    $referer        referer information to pass, if any<br />
    $cookies        cookies to pass if any<br />
    $rawheaders        other header info to pass, if any<br />
    $maxredirs        maximum redirects to allow. 0=none allowed. (5)<br />
    $offsiteok        whether or not to allow redirects off-site. (true)<br />
    $expandlinks    whether or not to expand links to fully qualified URLs (true)<br />
    $user            authentication username, if any<br />
    $pass            authentication password, if any<br />
    $accept            http accept types (image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*)<br />
    $error            where errors are sent, if any<br />
    $response_code    responde code returned from server<br />
    $headers        headers returned from server<br />
    $maxlength        max return data length<br />
    $read_timeout    timeout on read operations (requires PHP 4 Beta 4+)<br />
                    set to 0 to disallow timeouts<br />
    $timed_out        true if a read operation timed out (requires PHP 4 Beta 4+)<br />
    $maxframes        number of frames we will follow<br />
    $status            http status of fetch<br />
    $temp_dir        temp directory that the webserver can write to. (/tmp)<br />
    $curl_path        system path to cURL binary, set to false if none<br />
  </p>
<p>EXAMPLES:</p>
<p>    Example:     fetch a web page and display the return headers and<br />
                the contents of the page (html-escaped):<br />
  <br />
    include &#8220;Snoopy.class.php&#8221;;<br />
    $snoopy = new Snoopy;<br />
  <br />
    $snoopy-&gt;user = &#8220;joe&#8221;;<br />
    $snoopy-&gt;pass = &#8220;bloe&#8221;;<br />
  <br />
    if($snoopy-&gt;fetch(&#8221;<a href="http://www.slashdot.org/">http://www.slashdot.org/</a>&#8220;))<br />
    {<br />
        echo &#8220;response code: &#8220;.$snoopy-&gt;response_code.&#8221;&lt;br&gt;\n&#8221;;<br />
        while(list($key,$val) = each($snoopy-&gt;headers))<br />
            echo $key.&#8221;: &#8220;.$val.&#8221;&lt;br&gt;\n&#8221;;<br />
        echo &#8220;&lt;p&gt;\n&#8221;;<br />
      <br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
    }<br />
    else<br />
        echo &#8220;error fetching document: &#8220;.$snoopy-&gt;error.&#8221;\n&#8221;;</p>
<p>    Example:    submit a form. and print out the result headers<br />
                and html-escaped page:</p>
<p>    include &#8220;Snoopy.class.php&#8221;;<br />
    $snoopy = new Snoopy;<br />
  <br />
    $submit_url = &#8220;<a href="http://lnk.ispi.net/texis/scripts/msearch/netsearch.html">http://lnk.ispi.net/texis/scripts/msearch/netsearch.html</a>&#8220;;<br />
  <br />
    $submit_vars[&#8221;q&#8221;] = &#8220;amiga&#8221;;<br />
    $submit_vars[&#8221;submit&#8221;] = &#8220;Search!&#8221;;<br />
    $submit_vars[&#8221;searchhost&#8221;] = &#8220;Altavista&#8221;;</p>
<p>      <br />
    if($snoopy-&gt;submit($submit_url,$submit_vars))<br />
    {<br />
        while(list($key,$val) = each($snoopy-&gt;headers))<br />
            echo $key.&#8221;: &#8220;.$val.&#8221;&lt;br&gt;\n&#8221;;<br />
        echo &#8220;&lt;p&gt;\n&#8221;;<br />
      <br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
    }<br />
    else<br />
        echo &#8220;error fetching document: &#8220;.$snoopy-&gt;error.&#8221;\n&#8221;;</p>
<p>    Example:    showing functionality of all the variables:<br />
  </p>
<p>    include &#8220;Snoopy.class.php&#8221;;<br />
    $snoopy = new Snoopy;</p>
<p>    $snoopy-&gt;proxy_host = &#8220;my.proxy.host&#8221;;<br />
    $snoopy-&gt;proxy_port = &#8220;8080&#8243;;<br />
  <br />
    $snoopy-&gt;agent = &#8220;(compatible; MSIE 4.01; MSN 2.5; AOL 4.0; Windows 98)&#8221;;<br />
    $snoopy-&gt;referer = &#8220;<a href="http://www.microsnot.com/">http://www.microsnot.com/</a>&#8220;;<br />
  <br />
    $snoopy-&gt;cookies[&#8221;SessionID&#8221;] = 238472834723489l;<br />
    $snoopy-&gt;cookies[&#8221;favoriteColor&#8221;] = &#8220;RED&#8221;;<br />
  <br />
    $snoopy-&gt;rawheaders[&#8221;Pragma&#8221;] = &#8220;no-cache&#8221;;<br />
  <br />
    $snoopy-&gt;maxredirs = 2;<br />
    $snoopy-&gt;offsiteok = false;<br />
    $snoopy-&gt;expandlinks = false;<br />
  <br />
    $snoopy-&gt;user = &#8220;joe&#8221;;<br />
    $snoopy-&gt;pass = &#8220;bloe&#8221;;<br />
  <br />
    if($snoopy-&gt;fetchtext(&#8221;<a href="http://www.phpbuilder.com/">http://www.phpbuilder.com</a>&#8220;))<br />
    {<br />
        while(list($key,$val) = each($snoopy-&gt;headers))<br />
            echo $key.&#8221;: &#8220;.$val.&#8221;&lt;br&gt;\n&#8221;;<br />
        echo &#8220;&lt;p&gt;\n&#8221;;<br />
      <br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
    }<br />
    else<br />
        echo &#8220;error fetching document: &#8220;.$snoopy-&gt;error.&#8221;\n&#8221;;<br />
    Example:     fetched framed content and display the results<br />
  <br />
    include &#8220;Snoopy.class.php&#8221;;<br />
    $snoopy = new Snoopy;<br />
  <br />
    $snoopy-&gt;maxframes = 5;<br />
  <br />
    if($snoopy-&gt;fetch(&#8221;<a href="http://www.ispi.net/">http://www.ispi.net/</a>&#8220;))<br />
    {<br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results[0]).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results[1]).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
        echo &#8220;&lt;PRE&gt;&#8221;.htmlspecialchars($snoopy-&gt;results[2]).&#8221;&lt;/PRE&gt;\n&#8221;;<br />
    }<br />
    else<br />
        echo &#8220;error fetching document: &#8220;.$snoopy-&gt;error.&#8221;\n&#8221;;</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=207</wfw:commentRss>
		</item>
		<item>
		<title>php Snoopy手册 中文版</title>
		<link>http://liminjun.cn/?p=206</link>
		<comments>http://liminjun.cn/?p=206#comments</comments>
		<pubDate>Tue, 04 Aug 2009 08:45:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=206</guid>
		<description><![CDATA[Snoopy是什么?
Snoopy是一个php类，用来模仿web浏览器的功能，它能完成获取网页内容和发送表单的任务。
Snoopy的一些特点:
* 方便抓取网页的内容
* 方便抓取网页的文本内容 (去除HTML标签)
* 方便抓取网页的链接
* 支持代理主机
* 支持基本的用户名/密码验证
* 支持设置 user_agent, referer(来路), cookies 和 header content(头文件)
* 支持浏览器转向，并能控制转向深度
* 能把网页中的链接扩展成高质量的url(默认)
* 方便提交数据并且获取返回值
* 支持跟踪HTML框架(v0.92增加)
* 支持再转向的时候传递cookies (v0.92增加)
要求:
Snoopy requires PHP with PCRE (Perl Compatible Regular Expressions),
which should be PHP 3.0.9 and up. For read timeout support, it requires
PHP 4 Beta 4 or later. Snoopy was developed and tested with PHP 3.0.12.
类方法:
fetch($URI)
&#8212;&#8212;&#8212;&#8211;
这是为了抓取网页的内容而使用的方法。
$URI参数是被抓取网页的URL地址。
抓取的结果被存储在 $this-&#62;results 中。
如果你正在抓取的是一个框架，Snoopy将会将每个框架追踪后存入数组中，然后存入 [...]]]></description>
			<content:encoded><![CDATA[<p>Snoopy是什么?</p>
<p>Snoopy是一个php类，用来模仿web浏览器的功能，它能完成获取网页内容和发送表单的任务。</p>
<p>Snoopy的一些特点:</p>
<p>* 方便抓取网页的内容<br />
* 方便抓取网页的文本内容 (去除HTML标签)<br />
* 方便抓取网页的链接<br />
* 支持代理主机<br />
* 支持基本的用户名/密码验证<br />
* 支持设置 user_agent, referer(来路), cookies 和 header content(头文件)<br />
* 支持浏览器转向，并能控制转向深度<br />
* 能把网页中的链接扩展成高质量的url(默认)<br />
* 方便提交数据并且获取返回值<br />
* 支持跟踪HTML框架(v0.92增加)<br />
* 支持再转向的时候传递cookies (v0.92增加)</p>
<p>要求:</p>
<p>Snoopy requires PHP with PCRE (Perl Compatible Regular Expressions),<br />
which should be PHP 3.0.9 and up. For read timeout support, it requires<br />
PHP 4 Beta 4 or later. Snoopy was developed and tested with PHP 3.0.12.</p>
<p>类方法:</p>
<p>fetch($URI)<br />
&#8212;&#8212;&#8212;&#8211;</p>
<p>这是为了抓取网页的内容而使用的方法。<br />
$URI参数是被抓取网页的URL地址。<br />
抓取的结果被存储在 $this-&gt;results 中。<br />
如果你正在抓取的是一个框架，Snoopy将会将每个框架追踪后存入数组中，然后存入 $this-&gt;results。</p>
<p>fetchtext($URI)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>本方法类似于fetch()，唯一不同的就是本方法会去除HTML标签和其他的无关数据，只返回网页中的文字内容。</p>
<p>fetchform($URI)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>本方法类似于fetch()，唯一不同的就是本方法会去除HTML标签和其他的无关数据，只返回网页中表单内容(form)。</p>
<p>fetchlinks($URI)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>本方法类似于fetch()，唯一不同的就是本方法会去除HTML标签和其他的无关数据，只返回网页中链接(link)。<br />
默认情况下，相对链接将自动补全，转换成完整的URL。</p>
<p>submit($URI,$formvars)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>本方法向$URL指定的链接地址发送确认表单。$formvars是一个存储表单参数的数组。<br />
submittext($URI,$formvars)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>本方法类似于submit()，唯一不同的就是本方法会去除HTML标签和其他的无关数据，只返回登陆后网页中的文字内容。</p>
<p>submitlinks($URI)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>本方法类似于submit()，唯一不同的就是本方法会去除HTML标签和其他的无关数据，只返回网页中链接(link)。<br />
默认情况下，相对链接将自动补全，转换成完整的URL。<br />
类属性: (缺省值在括号里)</p>
<p>$host 连接的主机<br />
$port 连接的端口<br />
$proxy_host 使用的代理主机，如果有的话<br />
$proxy_port 使用的代理主机端口，如果有的话<br />
$agent 用户代理伪装 (Snoopy v0.1)<br />
$referer 来路信息，如果有的话<br />
$cookies cookies， 如果有的话<br />
$rawheaders 其他的头信息, 如果有的话<br />
$maxredirs 最大重定向次数， 0=不允许 (5)<br />
$offsiteok whether or not to allow redirects off-site. (true)<br />
$expandlinks         是否将链接都补全为完整地址 (true)<br />
$user 认证用户名, 如果有的话<br />
$pass 认证用户名, 如果有的话<br />
$accept http 接受类型 (image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*)<br />
$error 哪里报错, 如果有的话<br />
$response_code 从服务器返回的响应代码<br />
$headers 从服务器返回的头信息<br />
$maxlength 最长返回数据长度<br />
$read_timeout 读取操作超时 (requires PHP 4 Beta 4+)<br />
设置为0为没有超时<br />
$timed_out 如果一次读取操作超时了，本属性返回 true (requires PHP 4 Beta 4+)<br />
$maxframes 允许追踪的框架最大数量<br />
$status 抓取的http的状态<br />
$temp_dir 网页服务器能够写入的临时文件目录 (/tmp)<br />
$curl_path cURL binary 的目录, 如果没有cURL binary就设置为 false</p>
<p><a href="http://blog.csdn.net/milliybaby/archive/2009/04/28/4131597.aspx"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=206</wfw:commentRss>
		</item>
		<item>
		<title>被保护: 域名备忘录</title>
		<link>http://liminjun.cn/?p=205</link>
		<comments>http://liminjun.cn/?p=205#comments</comments>
		<pubDate>Wed, 29 Jul 2009 11:35:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=205</guid>
		<description><![CDATA[这篇文章受保护，因此没有摘要。]]></description>
			<content:encoded><![CDATA[<form action="http://liminjun.cn/wp-pass.php" method="post">
<p>这篇文章受到密码保护。要阅读它，请在下面输入您的密码:</p>
<p><label>密码:<br />
<input name="post_password" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="提交" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=205</wfw:commentRss>
		</item>
		<item>
		<title>比文招亲的对联</title>
		<link>http://liminjun.cn/?p=204</link>
		<comments>http://liminjun.cn/?p=204#comments</comments>
		<pubDate>Fri, 24 Jul 2009 17:36:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=204</guid>
		<description><![CDATA[网上一美女出题，比文招亲，其中看到一个对联很有意思，
人言有信，此情一生一世，恐惹悲愁怎思念
对联相互照应，后面以7个心结尾，对应前面的 信 情，情也是心 旁，下联确实难对，节选了部分网友的应对：
月出未胐，那夜双宿双飞，续织缠绵终纠结。
心中有忠，此义三世三代，怯怕忧伤惜惆怅
山我为峨，来路九弯九拐，答等笑笛管箫箜
木西为栖,   今生双宿双飞,    浅渡泽湖泛涟漪
个人感觉还不算完美，期待达人解题了
]]></description>
			<content:encoded><![CDATA[<p>网上一美女出题，比文招亲，其中看到一个对联很有意思，<br />
人言有信，此情一生一世，恐惹悲愁怎思念<br />
对联相互照应，后面以7个心结尾，对应前面的 信 情，情也是心 旁，下联确实难对，节选了部分网友的应对：</p>
<p>月出未胐，那夜双宿双飞，续织缠绵终纠结。</p>
<p>心中有忠，此义三世三代，怯怕忧伤惜惆怅</p>
<p>山我为峨，来路九弯九拐，答等笑笛管箫箜</p>
<p>木西为栖,   今生双宿双飞,    浅渡泽湖泛涟漪</p>
<p>个人感觉还不算完美，期待达人解题了</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=204</wfw:commentRss>
		</item>
		<item>
		<title>拯救网站</title>
		<link>http://liminjun.cn/?p=203</link>
		<comments>http://liminjun.cn/?p=203#comments</comments>
		<pubDate>Thu, 23 Jul 2009 02:59:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=203</guid>
		<description><![CDATA[真的是很久很久都没有仔细打点网站了，虽然访问量每天在1万ip，在过去的9个月，我并没有因此而给予更多的观注。我真该好好规划规划了，让那些已经有影响力的网站得到发展。那些有前途的站，应持续做下去。手上的域名不能荒废，我至今仍在考虑是否对一个昂贵的2位域名续费。虽然是孤品，但我经营的压力太大。很难取舍啊，说不定10年后，我又丢掉了一个很值钱的域名。
]]></description>
			<content:encoded><![CDATA[<p>真的是很久很久都没有仔细打点网站了，虽然访问量每天在1万ip，在过去的9个月，我并没有因此而给予更多的观注。我真该好好规划规划了，让那些已经有影响力的网站得到发展。那些有前途的站，应持续做下去。手上的域名不能荒废，我至今仍在考虑是否对一个昂贵的2位域名续费。虽然是孤品，但我经营的压力太大。很难取舍啊，说不定10年后，我又丢掉了一个很值钱的域名。</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=203</wfw:commentRss>
		</item>
		<item>
		<title>300年一遇的暴雨</title>
		<link>http://liminjun.cn/?p=202</link>
		<comments>http://liminjun.cn/?p=202#comments</comments>
		<pubDate>Wed, 22 Jul 2009 13:22:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=202</guid>
		<description><![CDATA[300年一遇的事，遇到上海下暴雨，早上的时候，我还特意看了下太阳，电视上说初亏已至。我抬头只看到乌云缝隙里耀眼的光芒，刺的我的眼睛很不舒服，没看出啥。就坐车出门了。
在黄浦江边，9点36分，天的确是黑了一会。我也只能从这个情况感受下全国人民看日食的气氛。电视上，报纸上，网络上铺天盖地的介绍，给我的感觉是，中国人民的精神领域都太过空虚了，都在期待一点新鲜的事务来刺激一下发涨的神经。我记得92年的时候，那会我在仙桃读初中，在中学的阳台上，我见到了日全食，那个时候，人群也没这么夸张。路过的老师也不忘教育一下我们，这个叫天狗食日。
我感受不到现在的生活有什么可以怀念的，但是很多年以后，我还是会怀念现在的生活。
]]></description>
			<content:encoded><![CDATA[<p>300年一遇的事，遇到上海下暴雨，早上的时候，我还特意看了下太阳，电视上说初亏已至。我抬头只看到乌云缝隙里耀眼的光芒，刺的我的眼睛很不舒服，没看出啥。就坐车出门了。</p>
<p>在黄浦江边，9点36分，天的确是黑了一会。我也只能从这个情况感受下全国人民看日食的气氛。电视上，报纸上，网络上铺天盖地的介绍，给我的感觉是，中国人民的精神领域都太过空虚了，都在期待一点新鲜的事务来刺激一下发涨的神经。我记得92年的时候，那会我在仙桃读初中，在中学的阳台上，我见到了日全食，那个时候，人群也没这么夸张。路过的老师也不忘教育一下我们，这个叫天狗食日。<br />
我感受不到现在的生活有什么可以怀念的，但是很多年以后，我还是会怀念现在的生活。</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=202</wfw:commentRss>
		</item>
		<item>
		<title>房贷纪念日</title>
		<link>http://liminjun.cn/?p=201</link>
		<comments>http://liminjun.cn/?p=201#comments</comments>
		<pubDate>Mon, 20 Jul 2009 05:23:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[My life]]></category>

		<guid isPermaLink="false">http://liminjun.cn/?p=201</guid>
		<description><![CDATA[今天是个特殊的日子，所以再忙，我也要抽时间写些东西纪念一下。房子买了1年了，今天是房贷纪念日一周年，换句话说就是当房奴满一年。
要说生活的变化，那真是酸甜苦辣咸五味俱全。原本是小康生活水平，一夜回到解放前啊，虽然说在平时的生活中，变化不大，但我心里清楚，那是因为，付了首期后，还有微薄的存款。每次不够用的时候，就会从存款里支出。我的工作并不固定，但我知道这个存款，这样继续下去，总有干涸的时候。
所以，对每一个支出，都会考虑，这个是必须的，还是，可以商榷的，还是，可以节省的。可以商榷的，那就下个月吧，可以节省的，那得坚决执行，必须的则是该花则花。一年这样的日子过去了，后面还有好多个这样的日子，真想不出那会房贷，贷款的时候,说20年，30年贷款，那里来的勇气，真是站着说话不腰疼。房贷越长，生活质量就会越差。
后面的生活，坚决要提前还贷，今年做了个榜样，已经提前还了2年，希望明年再提前2年。咬紧牙根，紧缩银根，只有一个念头，尽快清帐。
结束房贷的日子一定很幸福。
]]></description>
			<content:encoded><![CDATA[<p>今天是个特殊的日子，所以再忙，我也要抽时间写些东西纪念一下。房子买了1年了，今天是房贷纪念日一周年，换句话说就是当房奴满一年。<br />
要说生活的变化，那真是酸甜苦辣咸五味俱全。原本是小康生活水平，一夜回到解放前啊，虽然说在平时的生活中，变化不大，但我心里清楚，那是因为，付了首期后，还有微薄的存款。每次不够用的时候，就会从存款里支出。我的工作并不固定，但我知道这个存款，这样继续下去，总有干涸的时候。<br />
所以，对每一个支出，都会考虑，这个是必须的，还是，可以商榷的，还是，可以节省的。可以商榷的，那就下个月吧，可以节省的，那得坚决执行，必须的则是该花则花。一年这样的日子过去了，后面还有好多个这样的日子，真想不出那会房贷，贷款的时候,说20年，30年贷款，那里来的勇气，真是站着说话不腰疼。房贷越长，生活质量就会越差。</p>
<p>后面的生活，坚决要提前还贷，今年做了个榜样，已经提前还了2年，希望明年再提前2年。咬紧牙根，紧缩银根，只有一个念头，尽快清帐。<br />
结束房贷的日子一定很幸福。</p>
]]></content:encoded>
			<wfw:commentRss>http://liminjun.cn/?feed=rss2&amp;p=201</wfw:commentRss>
		</item>
	</channel>
</rss>
