Capture the HTML content of the web page with the PHP programming language

time:10-07-05 forum:PHP tools and code
  Reprinted from http://hi.baidu.com/straul/blog/item/e577acc3cada3152b219a850.html

first, put some smaller programs, but the function and actual effects need to be improved.

(1), use PHP to get web content
>! -- m -->http://hi.baidu.com/quqiufeng/blog/item... E7150.html1,
$xhr = new COM (.Quot; MSXML2.XMLHTTP.quot;);
$xhr-.gt; open. .quot; http://www.blogjava.net/pts.quot;
echo file_get_contents ($url);
.Gt; [/code]

3, fopen (). 1, 10);
Fclose ($stream);
}

if ($stream = fopen ('http://www.sohu.net','r')) {
/ > 5. Class= "postlink" href= "http://www.blogjava.net/pts/archive/2007/08/26/99188.html" >http://www.blogjava.net/pts/archive/200... 99188.html
simple practice:
[code].lt;? Php
$url=.quot;
or:
[code].lt;?
if ($stream = fopen) {
/ / print all. / / / / print the first 5 bytes
echo stream_get_contents ($stream, 5);
Fclose ($stream);
}
G.chinaunix.net/u1/44325/showart_348444.html
[code].lt;?
$my_book_url='http://book.yunxiaoge.com/files/article/html/4/4550/index.html';
ereg (.Quot; http://book.yunxiaoge.com/files/article/html/.#91; 0-9.#93; /. $myBook.#91; 0.#93;;
$file_handle = fopen ($my_book_url,.Quot; r.quot;); / / / / read the file
unlink (.Quot; test.txt.quot;); Ml.quot; $line, $reg);
$handle = fopen (.Quot; test.txt.quot;'a');
if ($line1) / >; $my_book_txt_url);
$my_book_txt_over_url=.quot; $my_book_txt$my_book_txt_url.quot; / / / / / / / / / / / >
echo.Quot; $my_book_txt_over_url.lt; /p.gt;.Quot; / / / / / > $file_handle_txt = = / / / / / read converted grasp. Take the address
while (! Feof ($file_handle_txt)) {
$line_txt = fgets ($file_handle_txt);
$line1=ereg (.Quot; ^.amp; $file_handle_txt); / / / / Amp; nbsp;.Amp; nbsp;.Amp; nbsp;.Quot;.Quot;.Quot; $my_over_txt); Br / > $my_over_txt=str_replace (.Quot;.Amp; quot;.Quot;.Quot;.Quot; $my_over_txt);
if ($line1) / > >fclose ($file_handle); / / close file
echo.Quot; finish.Lt; /p.gt;.Quot;
.Gt; [/code]
  • 2
  • 3
  • 4

prev:Ji'nan announces driving school pass rat... next:PHP implements code conversion between G...
post comment
Notice



approved   Ji'nan Ying Bi Street School: specia...   Reminder: at present, there are only...   Online test site PING value, network...   Expired domain name query   
rand   PHP curl function simulation browser...   PHP uses curl to simulate user landi...   MYSQL query optimization   PHP completely filters HTML, JS, CSS...   PHP extraction of Chinese characters...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com