Home  >  Article  >  php教程  >  php提取osc最近发动弹的人

php提取osc最近发动弹的人

WBOY
WBOYOriginal
2016-06-06 19:34:42900browse

php提取osc最近发动弹的人 无 ?php/* @Author 70(781787584) * @Url http://www.mlrzw.cn */set_time_limit(0);header("Content-Type: text/html;charset=utf-8");for ($i = 0; $i 300; $i++) {$url = 'http://www.oschina.net/fetch_tweets?p='.$i;$ch = cur

php提取osc最近发动弹的人
<?php
/* @Author 70(781787584)
 * @Url http://www.mlrzw.cn
 */

set_time_limit(0);
header("Content-Type: text/html;charset=utf-8");

for ($i = 0; $i < 300; $i++) {
	$url = 'http://www.oschina.net/fetch_tweets?p='.$i;
	$ch = curl_init ();
	curl_setopt ( $ch, CURLOPT_URL, $url );
	curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
	curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
	curl_setopt ( $ch, CURLOPT_REFERER, '' );
	$html = curl_exec ( $ch );
	$curl_err  = curl_errno ( $ch );
	$curl_info = curl_getinfo ( $ch );
	curl_close ( $ch );

	
	$pattern = '/'.preg_quote(' title="','/').'(.*?)'.preg_quote('" class="SmallPortrait','/').'/i';
	preg_match_all( $pattern,$html, $result );
	
	
	if ($result[1]) {
		$str = implode(' @', $result[1]);
		file_put_contents("osc.txt", ' @'.$str , FILE_APPEND);
	}
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn