1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| <?php
require 'simplehtmldom/simple_html_dom.php';
$loginurl='http://www.pixiv.net/index.php';
$pixiv_id='';
$password='';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER , 0 );
curl_setopt($curl, CURLOPT_USERAGENT ,'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; (R1 1.5); InfoPath.2)');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt($curl, CURLOPT_RETURNTRANSFER , 1 );
curl_setopt($curl, CURLOPT_COOKIEJAR , 'cookie.txt');
curl_setopt($curl, CURLOPT_COOKIEFILE , 'cookie.txt');
curl_setopt($curl, CURLOPT_POST , 1 );
curl_setopt($curl, CURLOPT_COOKIESESSION ,true);
curl_setopt($curl, CURLOPT_URL , $loginurl);
curl_setopt($curl, CURLOPT_POSTFIELDS , 'mode=login&pixiv_id='.$pixiv_id.'&pass='.$password );
curl_exec($curl);
$p=1;
$bookmark_rest='show';//show
do{
$url='http://www.pixiv.net/bookmark.php?type=user&rest='.$bookmark_rest.'&p='.$p;
curl_setopt($curl, CURLOPT_URL , $url);
$profile=curl_exec($curl);
$dom1 = new simple_html_dom ();
$dom1 = str_get_html ($profile);
$test=$dom1->find('div#content2 div[align="right"]',0 )->plaintext;
preg_match('/次の(.*?)件/',$test,$match);
$title2 = $dom1->find('div#content2 form#f div[style="width:140px;height:130px;float:left;text-align:center;"]');
foreach($title2 as $illsthtml){
$illst = $illsthtml->outertext;
$illst=preg_replace('/<div(.*?)"><input(.*?)><\/div>/','',$illst);
$illst=preg_replace('/\n/', '',$illst);
$illst=preg_replace('/<img(.*?)>/', '',$illst);
preg_match_all('/<a href="member.php\?id=(.*?)"><\/a><div style=\"padding-top:5px;\">(.*?)<\/div>(<a href="jump.php\?(.*?)" target="_blank"><\/a>)?/', $illst,$match2,PREG_SET_ORDER );
foreach ($match2 as $val) {
echo 'http://www.pixiv.net/member.php?id='.$val[1].' - '.$val[2 ];
if(!empty($val[4 ])){echo ' - '.$val[4 ];}
echo "<br />\n";
}
}
$dom1->__destruct ();//解決Memory Leaks的問題
unset($profile,$dom1,$test);
$p++;
}while(!empty($match));
curl_close($curl);
?> |