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

php提取osc最近发动弹的人

WBOY
Release: 2016-06-06 19:34:42
Original
909 people have browsed it

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);
	}
}

Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template