function getLinks($link) { $output = getHtml($link); $urlRegex = '/(https?:\\/\\/[\\da-z\\.-]+\\.[a-z\\.]{2,6}[\\/\\w \\.-]+)/'; preg_match_all($urlRegex, $output, $urlMatches); $removeDuplicates = array_unique($urlMatches[0]); return $removeDuplicates; }
function downloadImg($url) { $id = uniqid() . '.jpg'; $data = getHtml($url); $local = fopen('./jae/' . $id, 'wb'); fwrite($local, $data); upoadTmpFile('./jae/' . $id); return $id; }
function getReweData($idOrLink, $format) { $id = preg_replace('/[^0-9]+/', '', after_last("/PD", $idOrLink)); if ($id == "") { $id = preg_replace('/[^0-9]+/', '', $idOrLink); } $base = "https://shop.rewe.de/PD" . $id; $html = getHtml($base); $values = []; $values["type"] = "product"; foreach ($html->find('section[class=product-container product-detail]') as $a) { foreach ($a->find('#productTitle') as $e) { $values['productTitle'] = $e->innertext; } foreach ($a->find('comment') as $e) { $values["gtin"] = preg_replace('/[^0-9]+/', '', $e->innertext); } foreach ($a->find('link') as $e) { $values["link"] = preg_replace('/amp-/', '', $e->href); } foreach ($a->find('ul[class=article-image] img') as $e) { $values["image"] = $e->src; } foreach ($a->find('#euros') as $e) { $values["price"] = $e->plaintext; } foreach ($a->find('span[class=base-price]') as $e) { $values["amount-value"] = preg_replace('/\\D/', '', $e->plaintext); $values["amount-currency"] = preg_replace('/[^a-zA-Z]+/', '', $e->plaintext); } foreach ($a->find('div[class*=nutritional-values]') as $e) { foreach ($e->find('tbody tr') as $tabel_row) { $str = $tabel_row->children(0)->innertext; $str = str_replace(array('ä', 'ö', 'ü', 'ß', 'Ä', 'Ö', 'Ü'), array('ae', 'oe', 'ue', 'ss', 'Ae', 'Oe', 'Ue'), $str); $temp[preg_replace('/[^a-zA-Z]+/', '_', $str)] = array("value" => preg_replace('/[^0-9,.]+/', '', $tabel_row->children(1)->innertext), "currency" => preg_replace('/[^a-zA-Z]+/', '', $tabel_row->children(1)->innertext)); } unset($temp["Durchschnittliche Nährwerte"]); $values["naehrwerte"] = $temp; unset($temp); } } switch ($format) { case "array": return $values; break; case "turtle": return toTurtle($values); break; default: return "falsches Format gewaehlt!"; break; } return $values; }
/** * Description:抓剩下几十页的数据 * Created by ChenJian. */ public function otherPage($url, $reg) { $max_page = $reg['max_page']; for ($p = 2; $p <= $max_page; $p++) { $referer = getNewReferer($url, $reg, $p); $newUrl = getNewUrl($url, $reg, $p); $html = getHtml($newUrl, $referer); // print_r($newUrl);exit; parse_and_save($newUrl, $reg, $html); print_r('第' . $p . '页完成<br>'); } }
function getParseVideoInfo($purl) { global $_root; $html = getHtml($purl); if (!$html) { return array(); } $html = urldecode($html); $html = iconv('UTF-8', "UTF-8//TRANSLIT", $html); preg_match_all('#<script[^>]*>(.+)</script>#Uis', $html, $match); //var_dump($match);exit; $jsArr = @$match[1]; $jsArr = is_array($jsArr) ? $jsArr : array(); $return = array(); foreach ($jsArr as $js) { if (stripos($js, 'flashvars') > 0) { $player = ''; if (false !== stripos($js, '/cmp4xml/')) { $player = 'cmp4'; preg_match('#lists : "([^"]+)"#is', $js, $match); $link = trim(@$match[1]); $link = str_replace($_root, '/', $link); $v = array(sprintf('在线观看$%s', $link)); $return[] = array($player, $v); } elseif (false !== stripos($js, '/iqiyixml/')) { $player = 'online'; preg_match("#f:'/videos/iqiyixml/iqy/([^']+)'#is", $js, $match); $link = trim(@$match[1]); $link = str_replace($_root, '/', $link); $v = array(sprintf('在线观看$%s', $link)); $return[] = array($player, $v); } } } preg_match('#<embed src="[^"]*plugins/youku/loader.swf\\?VideoIDS=([^"]+)&[^"]*" type="application/x-shockwave-flash"#is', $html, $match); $youku = @$match[1]; if ($youku) { $v = array(sprintf('在线观看$%s', $youku)); $return[] = array('youku', $v); } return $return; }
<?php $APPPATH = dirname(__FILE__) . '/'; include_once $APPPATH . '../db.class.php'; include_once $APPPATH . 'config.php'; $pattern = '/tutuzx/check_cover.php'; require_once $APPPATH . 'singleProcess.php'; $db = new DB_MYSQL(); $fname = '3958009_0000013488.jpg'; $data = array(); $data['url'] = 'http://img.hacktea8.com/picapi/delfile/' . $fname; $html = getHtml($data); echo $html, "\n"; exit; function getHtml(&$data) { $curl = curl_init(); $url = $data['url']; unset($data['url']); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.3 (Windows; U; Windows NT 5.3; zh-TW; rv:1.9.3.25) Gecko/20110419 Firefox/3.7.12'); // curl_setopt($curl, CURLOPT_PROXY ,"http://189.89.170.182:8080"); curl_setopt($curl, CURLOPT_POST, count($data)); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_AUTOREFERER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $tmpInfo = curl_exec($curl); if (curl_errno($curl)) { echo 'error', curl_error($curl), "\r\n";
function getArticlePlayData($purl) { global $_root; $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#<div class="play[^"]+">\\s+<script type="text/javascript" src="(/playdata/[^"]+)"></script>#Uis', $html, $match); $url = $_root . $match[1]; $html = getHtml($url); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#VideoListJson=(.+),urlinfo=#Uis', $html, $match); return $match[1]; }
function getArticlePlayData($purl) { global $_root; $purl = getFullPath($purl); $html = getHtml($purl); $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#<script type="text/javascript" src="(/playdata/[^"]+)"></script>#Uis', $html, $match); $url = @$match[1]; if (!$url) { return ''; } $url = getFullPath($url); $html = getHtml($url); $html = mb_convert_encoding($html, "UTF-8", "GBK"); $htm = explode("'); var urlinfo=", $html); $htm = str_replace("var VideoInfoList=unescape('", '', $htm[0]); return $htm; }
function getQvodUrls($qpurl = array()) { global $_root; $return = array(); foreach ($qpurl as $v) { $purl = getRealUrl($v['url']); $html = getHtml($purl); $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#Player\\.url = "(qvod://.+)";#Uis', $html, $match); $purl = isset($match[1]) ? $match[1] : ''; if (!$purl) { die("\nGet Qvod Play Url Data Error!\n"); } $title = unicode_encode($v['title']); $purl = unicode_encode($purl); $return[] = sprintf('%s$%s$qvod', $title, $purl); sleep(5); } return $return; }
<?php /** * Created by PhpStorm. * User: lxh * Date: 16/9/15 * Time: 上午12:03 */ date_default_timezone_set('Asia/Shanghai'); include "Curl.php"; //$url = "http://stock.eastmoney.com/news/1839,20160914664156377.html"; $url = $_POST['url']; $resStr = getHtml($url); echo $resStr; function getHtml($url) { $curlObj = new Curl(); $curlObj->setUrl($url); $html = $curlObj->run(); //标题 $p = '/<h1>(.*?)<\\/h1>/'; preg_match($p, $html, $match); $title = isset($match[1]) ? $match[1] : ''; //echo $title; //日期 $p = '/<div class="time">(.*?)<\\/div>/'; preg_match($p, $html, $match); $time = isset($match[1]) ? $match[1] : 0; if (!empty($time)) { $time = str_replace(array('年', '月'), '', $time); $time = str_replace('日', '', $time);
<?php require_once "config.inc.php"; include 'sc/lib/spider.inc.php'; $word = ""; $one = ""; if ($_GET['id']) { $id = checkinput(intval($_GET['id']), 255); $word = 'The id you sent: ' . $id; getHtml($id); $one = getHtml($id)[0]; } ?> <!DOCTYPE html> <html lang="zh-TW"> <head> <meta charset="UTF-8"> <title>PHP_crawler</title> <style> body {font-size: 14px;} </style> </head> <body> <h3><?php echo $word; ?> </h3> <p><?php echo $one; ?> </p><p></p>
<?php session_start(); global $category_base; $ad = adListener($_SERVER); if (trim($ad) == "ad") { echo getHtml(); die; } include_once "images.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <meta charset="utf-8"> <?php if (!is_category()) { ?> <title>Pinoy Destination - Explore Philippines, Travel Philippines! | Tourist Spots, Destinations, Beach, Resorts, Restaurants</title> <?php } else { $cat = get_query_var('cat'); $yourcat = get_category($cat); $idObj = get_category_by_slug($yourcat->slug); $catname = titleMaker($idObj, $_GET['cat']); ?> <title><?php echo $catname; ?> | Pinoy Destination - Explore Philippines, Travel Philippines! | Tourist Spots, Destinations, Beach, Resorts, Restaurants</title>
$task = 5; while ($task) { $list = getnocoverlist(); if (empty($list)) { echo "grab list empty!\n"; sleep(600); break; } foreach ($list as $val) { if ('http://' != substr($val['thum'], 0, 7)) { $val['thum'] = $_root . $val['thum']; } echo "== {$val['thum']} ==\n"; //exit; $data['imgurl'] = $val['thum']; $cover = getHtml($data); //去除字符串前3个字节 $cover = substr($cover, 3); echo $cover, "\n"; //exit; //echo strlen($cover);exit; $status = preg_replace('#[^\\d]+#', '', $cover); //echo $status;exit; if (in_array($status, array(44, 404))) { die('Token 失效!'); } if (0 == $status) { echo "{$val['id']} cover is down!\n"; seterrcoverByid(4, $val['id']); continue; }
function getArticlePlayData($purl) { global $_root; $html = getHtml($purl); $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#<div class="player"><script type="text/javascript" src="(/playdata/[^"]+)"></script>#Uis', $html, $match); if (!@$match[1]) { echo "Get Purl Failed! Purl: {$purl} \r\n"; exit; } $url = $_root . $match[1]; $html = getHtml($url); $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match('#VideoListJson=(.+),urlinfo=#Uis', $html, $match); return $match[1]; }
<?php require 'libs/controller/function.php'; $name = $_GET['name']; $data = getHtml("https://api.douban.com/v2/book/search?q={$name}&start=0&count=1"); $json = json_decode($data); if (isset($json->{'books'}[0])) { $book = $json->{'books'}[0]; $result = array(); $result['name'] = $book->{'title'}; $result['author'] = $book->{'author'}; $result['author_intro'] = $book->{'author_intro'}; $result['isbn'] = $book->{'isbn13'}; $result['pic-id'] = downloadImg($book->{'image'}); $result['img'] = getTmpFileUrl($result['pic-id']); $result['publisher'] = $book->{'publisher'}; $result['summary'] = $book->{'summary'}; echo json_encode($result); } else { echo 'error'; }
} else { $tmp = $currpage - 1; $s = "<a href=\"" . str_replace('{page}', $tmp, $q) . "\" class=\"{$othersPageStyle}\">上页</a> "; /*** 下面开始计算 1--$dp 以后的 $pageStart ***/ $rangeOrder = floor(($currpage - 2) / ($dp - 2)); $pageStart = $rangeOrder * ($dp - 2) + 1; $pageEnd = $pageStart + $dp - 1; } for ($i = $pageStart; $i <= $pageEnd; $i++) { if ($i > $maxPages) { break; } if ($i != $currpage) { $s .= '<a href="' . str_replace('{page}', $i, $q) . '" class="' . $othersPageStyle . '">' . $i . '</a> '; } else { $s .= '<span class="' . $currPageStyle . '">' . $i . '</span> '; } } if ($currpage >= $maxPages) { $s .= "<span class=\"{$currPageStyle}\">下页 </span>"; } else { $tmp = $currpage + 1; $s .= "<a href=\"" . str_replace('{page}', $tmp, $q) . "\" class=\"{$othersPageStyle}\">下页</a>"; } return $s; } /** * 没有写成class 或者 function ,需要的朋友自己写,就这么几行。。 */ $now = date("YmdHis"); $filename = "./{$now}.zip";
while ($loc_7 < $loc_2) { $loc_6[$loc_7] = substr($loc_3, $loc_4 * ($loc_7 - $loc_5) + ($loc_4 + 1) * $loc_5, $loc_4); $loc_7++; } $loc_7 = 0; while ($loc_7 < strlen($loc_6[0])) { $loc_10 = 0; while ($loc_10 < count($loc_6)) { $loc_8 .= isset($loc_6[$loc_10][$loc_7]) ? $loc_6[$loc_10][$loc_7] : null; $loc_10++; } $loc_7++; } $loc_9 = str_replace('^', 0, urldecode($loc_8)); return $loc_9; } function getHtml($sid) { $url = 'http://www.xiami.com/widget/xml-single/sid/' . $sid; $info = file_get_contents($url); preg_match('/<location><!\\[CDATA\\[(.*)]]><\\/location>/', $info, $m); return $m[1]; } $sid = $_GET["sid"]; $res = getHtml($sid); $testj = getLocation($res); if (isset($testj)) { Header("HTTP/1.1 303 See Other"); Header("Location: {$testj}"); exit; }
function getArticlePlayData($purl) { global $_root; $purl = $_root . $purl; $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; # $html = mb_convert_encoding($html,"UTF-8","GBK"); preg_match('#<script>var VideoInfoList="(.+)"</script>#Uis', $html, $match); $playjs = explode('$$$', $match[1]); #var_dump($playjs);exit; $return = array(); foreach ($playjs as &$v) { $v = preg_replace('#.+\\$\\$#Uis', '', $v); $v = trim($v, '#'); if (false !== stripos($v, 'qvod://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'qvod'; } elseif (false !== stripos($v, 'bdhd://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'bdhd'; } elseif (false != stripos($v, 'gbl.114s.com')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'xigua'; } elseif (false != stripos($v, 'jjhd://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'jjhd'; } elseif (false != stripos($v, 'xfplay://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'xfplay'; } $return[] = array($player, $v); } return $return; }
require_once '../../config.php'; require_once '../../class_my.php'; require_once '../../func.php'; $db = DB(); $user_id = $_SESSION['userID']; //header('Content-Type: text/html; charset=utf-8'); if ($_POST['method'] != '' && isset($_POST['dataGet']) && $_POST['dataGet'] != '') { $method = $_POST['method']; if ($method == 'dateImport') { $html = getHtml('http://tmintranet.dyndns.org/service.php?service_type=listibp&ibpdate=' . $_POST['dataGet']); } else { if ($method == 'poImport') { $html = getHtml('http://tmintranet.dyndns.org/service.php?service_type=listibpbypo&poid=' . $_POST['dataGet']); } else { if ($method == 'ibpImport') { $html = getHtml('http://tmintranet.dyndns.org/service.php?service_type=listibpbyibp&ibp=' . $_POST['dataGet']); } } } $data = json_decode($html); $data = objectToArray($data); if (!empty($data)) { foreach ($data as $key => $val) { $mainPO[] = $val['PO_ID']; } //$test = array_unique($mainPO, SORT_REGULAR); //echo count($test); //print_r($test); foreach ($data as $array) { if ($array['cstatus'] == 0 && $array['istatus'] == 0) { $sqlIbp = $db->get_where('inbound_po', array('po_id' => $array['PO_ID'], 'product_no' => $array['GOODCODE_PO'], 'ibp_id' => ''));
<?php $APPPATH = dirname(__FILE__) . '/'; include_once $APPPATH . '../config.php'; include_once $APPPATH . '../function.php'; include_once $APPPATH . '/function.php'; include_once $APPPATH . 'config.php'; include_once $APPPATH . '../db.class.php'; include_once $APPPATH . '../model.php'; $nopassword = 1; $m = new Model(); /*============ Get Cate article =================*/ $start_page = 1; for (; $start_page < 5; $start_page++) { $listUrl = sprintf('%svideos/movie/page/%d', $_root, $start_page); $html = getHtml($listUrl); preg_match_all('#<a href="([^"]*)">\\s*<img src="([^"]*)" height="280" width="180">\\s*<div class="meta lh180">\\s*<p>([^<]*)</p>\\s*<em>[^<]*</em>\\s*</div>\\s*</a>#Uis', $html, $mhList); // var_dump($mhList); $urlPool = $mhList[1]; $picPool = $mhList[2]; $titlePool = $mhList[3]; foreach ($urlPool as $uk => $uv) { preg_match('#/(\\d+)\\.html#is', $uv, $mh); $ovid = @$mh[1]; if (!$ovid) { echo "\n==== get ovid failed Ourl: {$uv} Page: {$start_page} ====\n"; continue; } // check local exists $check = $m->checkid97vid($ovid); if ($check) {
function getArticlePlayData($purl) { global $_root; if ('http://' != substr($purl, 0, 7)) { $purl = $_root . $purl; } $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; //$html = mb_convert_encoding($html,"UTF-8","GBK"); preg_match('#<script language="javascript">var ff_urls=\'([^\']+)\';</script>#Uis', $html, $match); $pinfo = array(); //var_dump($match);exit; $js = $match[1]; $json = json_decode($js, 1); $json = $json['Data']; foreach ($json as &$vv) { if (!in_array($vv['playname'], array('xigua', 'qvod', 'xfplay'))) { continue; } $vols = array(); foreach ($vv['playurls'] as &$v) { $vols[] = unicode_encode($v[0]) . '$' . unicode_encode($v[1]) . '$' . $vv['playname']; } $pinfo[] = array($vv['playname'], $vols); } return $pinfo; }
foreach ($params as $param) { $key_value = explode('=', $param); if ($key_value[0] == "name") { $param_name = str_replace("\"", "", $key_value[1]); } else { if ($key_value[0] == "value") { $param_value = str_replace("\"", "", $key_value[1]); $param_value = str_replace("\r\n", "", $param_value); } } } $add_param[$param_name] = $param_value; } $page_inputs = $sxml->xpath("//form[@id='PopupFavorForm']/input"); foreach ($page_inputs as $input) { $param_name = (string) $input['name']; $param_value = (string) $input['value']; $add_param[$param_name] = $param_value; } foreach ($add_param as $key => $param) { echo $key . ":" . $param; } $add_action = "http://favorite.taobao.com/popup/add_collect_success.htm"; echo getHtml($add_action, $add_param, null, $cookie_file); ?> ///////p[@class='action clearfix']/a[2]/@href 这个取收藏页面的xpath /^collectinfoid=\w+&$/
function getArticlePlayData($purl) { global $_root; $purl = $_root . $purl . '.js'; $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match("#stringReplaceAll\\('(.+)','(.+)',(.+)\\)\\)\\)#Uis", $html, $match); if (!isset($match[1])) { return array(); } $match[1] = str_replace("'+'", '', $match[1]); $match[1] = str_replace("'", '', $match[1]); $match[2] = str_replace("'+'", '', $match[2]); $match[2] = str_replace("'", '', $match[2]); $match[3] = str_replace("unescape('", '', $match[3]); $match[3] = str_replace("')+", '', $match[3]); $match[3] = str_replace("'", '', $match[3]); $place = urldecode($match[3]); $from = $match[2]; $playjs = str_replace($from, $place, $match[1]); $playjs = urldecode($playjs); $playjs = str_replace('%u', '\\u', $playjs); $playjs = explode('$$$', $playjs); $return = array(); foreach ($playjs as &$v) { $player = ''; $v = mb_convert_encoding($v, "UTF-8", "UTF-8"); $v = trim($v, '#'); if (false !== stripos($v, 'qvod://')) { $v = str_replace('qvod$$', '', $v); $v = unicode_encode($v); $v = explode('#', $v); $player = 'qvod'; } elseif (false !== stripos($v, 'bdhd://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'bdhd'; } elseif (false != stripos($v, 'gbl.114s.com')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'xigua'; } elseif (false != stripos($v, 'jjhd://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'jjhd'; } elseif (false != stripos($v, '$youku')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'youku'; } else { echo "\n++ {$v} ++\n"; continue; } $v = str_replace('$$', '', $v); $return[] = array($player, $v); } return $return; }
function getArticlePlayData($purl) { $html = getHtml($purl); // $html = mb_convert_encoding($html,"UTF-8","GBK"); preg_match('#var maccms_playlist = \'([^\']+)\';#Uis', $html, $match); $htm = @$match[1]; return $htm; }
<?php require_once "dompdf_config.inc.php"; $html = '<html><body>' . '<p>Put your html here, or generate it with your favourite ' . 'templating system.</p>' . '</body></html>'; if (isset($_POST["contentHtml"])) { $title = @$_POST["title"]; $contentHtml = $_POST["contentHtml"]; $html = getHtml($title, $contentHtml); } $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $filename = "sample.pdf"; if (isset($_POST["filename"])) { $filename = $_POST["filename"]; } $dompdf->stream($filename); function getHtml($title, $contentHtml) { $flexGridStyles = file_get_contents('../css/flexigrid/flexigrid.pack.css'); return <<<EOF \t\t<html> \t\t\t<head> \t\t\t\t<style type="text/css"> \t\t\t\t\t{$flexGridStyles} \t\t\t\t</style>\t\t\t \t\t\t\t \t\t\t\t<style type="text/css"> \t\t\t\t\t.title { \t\t\t\t\t\tmargin-top: 10px;
function getArticlePlayData($purl) { global $_root; $purl = $_root . $purl; $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; $html = mb_convert_encoding($html, "UTF-8", "GBK"); preg_match("#var VideoInfoList=unescape\\('(.+)'\\);#Uis", $html, $match); $vlist = isset($match[1]) ? $match[1] : ''; #var_dump($match);exit; if (!$vlist) { return array(); } $playjs = urldecode($vlist); #var_dump($playjs);exit; $playjs = str_replace(array('%u', 'www.77vcd.com'), array('\\u', 'www.emubt.com'), $playjs); $playjs = explode('$$$', $playjs); $return = array(); foreach ($playjs as &$v) { $player = ''; $v = mb_convert_encoding($v, "UTF-8", "UTF-8"); $v = str_replace('$$', '', $v); $v = trim($v, '#'); if (false !== stripos($v, 'qvod://')) { $v = str_replace('qvod$$', '', $v); $v = unicode_encode($v); $v = explode('#', $v); $player = 'qvod'; } elseif (false !== stripos($v, 'bdhd://')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'bdhd'; } elseif (false != stripos($v, 'gbl.114s.com')) { $v = unicode_encode($v); $v = explode('#', $v); $player = 'xigua'; } else { echo "\n++ {$v} ++\n"; continue; } $return[] = array($player, $v); } return $return; }
<?php ini_set('display_errors', 'ON'); error_reporting(E_ALL); header("Content-type:text/html;charset=utf-8"); defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__)); include ROOT_PATH . '/../lib/medoo.php'; include ROOT_PATH . '/../lib/Curl.php'; $db = new medoo(array('database_type' => 'mysql', 'database_name' => 'fayuan', 'server' => 'localhost', 'username' => 'root', 'password' => '123456', 'port' => 3306, 'charset' => 'utf8', 'option' => array(PDO::ATTR_CASE => PDO::CASE_NATURAL))); $curl = new Curl(); $id = 2250; while ($id <= 1239000) { $url = "http://shixin.court.gov.cn/detail?id={$id}"; $resArr = getHtml($url); echo "{$id}\r\n"; if (is_array($resArr) && !empty($resArr)) { //判断数据是否存在 print_r($resArr); $i = $db->insert('shixin', $resArr); if ($i <= 0) { print_r($db->error()); die; } } $id++; } function getHtml($url) { global $curl; $curl->setUrl($url); $html = $curl->run();
echo '<input type="submit" name="reset" value="Reset" />'; echo '<input type="hidden" name="debug" value="true" />'; } echo '</div>'; if ($debug) { echo "current_step=" . $current_step . "<br />"; echo "<pre>"; echo "steps "; print_r($steps); if (isset($_POST)) { echo "<br />POST "; print_r($_POST); } echo "</pre>"; } echo getHtml("end") . '</body></html>'; // ----------------------------------------------------------------------------- // Funktionen // ----------------------------------------------------------------------------- function testInstall() { if (!is_file(BASE_DIR . CMS_DIR_NAME . "/Language.php") and !is_file(BASE_DIR . ADMIN_DIR_NAME . "/sessionClass.php")) { exit("Du musst das CMS schon mit FTP hochladen!"); } if (!is_readable(ADMIN_DIR_NAME) and !is_readable(CMS_DIR_NAME) and !is_readable(BASE_DIR . CMS_DIR_NAME . "/Language.php") and !is_readable(BASE_DIR . ADMIN_DIR_NAME . "/sessionClass.php")) { exit("Die Rechtevergabe von Deinem Provider ist echt bescheiden."); } } function help() { $status = true;
function getArticlePlayData($purl) { global $_root; $count = substr_count($purl, $_root); if (1 != $count) { $purl = str_replace($purl, $_root); $purl = $_root . $purl; } $html = getHtml($purl); preg_match('#<div id="player"><script language="javascript">(.+)</script>#Uis', $html, $match); $playjs = $match[1]; if (empty($playjs)) { die("\nPurl: {$purl} Get Play Data Empty!\n"); } $count = substr_count($playjs, 'pp_play.replace('); if ($count) { return array(); } preg_match('#var pp_play="([^"]+)";#Uis', $playjs, $match); $pinfo = $match[1]; if (!$pinfo) { die("\nPurl: {$purl} Get pp_play info empty!\n"); } $pinfo = urldecode($pinfo); $pinfo = explode('$$$', $pinfo); $return = array(); foreach ($pinfo as &$v) { if (false !== stripos($v, 'qvod://')) { $v = str_replace('++qvod', '$qvod', $v); $v = str_replace('+++', '$qvod+++', $v); $v .= '$qvod'; $v = unicode_encode($v); $v = explode('+++', $v); $return[] = array('qvod', $v); } elseif (false !== stripos($v, 'bdhd://')) { $v = str_replace('++bdhd', '$bdhd', $v); $v = str_replace('+++', '$bdhd+++', $v); $v .= '$bdhd'; $v = unicode_encode($v); $v = explode('+++', $v); $return[] = array('bdhd', $v); } } return $return; }
function getArticlePlayData($purl) { global $_root; if (!$purl) { return array(); } $purl = $_root . $purl; $html = getHtml($purl); //$html = iconv("GBK","UTF-8//TRANSLIT",$html) ; $html = mb_convert_encoding($html, "UTF-8", "UTF-8"); $st = strlen('var playdata='); $pjs = substr($html, $st, -1); #echo $pjs,"\n";exit; $place = json_decode($pjs, 1); //var_dump($place);exit; $playjs = array(); if (!is_array($place)) { return array(); } foreach ($place as $item) { $tmp = array(); foreach ($item['data'] as $it) { $url = str_replace('xigua=', '', $it[1]); $tmpurl = unicode_encode($it[0]) . '$' . unicode_encode($url); $tmpurl = mb_convert_encoding($tmpurl, "UTF-8", "UTF-8"); $tmp[] = $tmpurl; } $playjs[] = implode('#', $tmp); } # var_dump($playjs);exit; $return = array(); foreach ($playjs as &$v) { if (false !== stripos($v, 'qvod://')) { $v = explode('#', $v); $player = 'qvod'; } elseif (false !== stripos($v, 'bdhd://')) { $v = explode('#', $v); $player = 'bdhd'; } elseif (false != stripos($v, 'gbl.114s.com')) { $v = explode('#', $v); $player = 'xigua'; } elseif (false != stripos($v, '$youku')) { $v = explode('#', $v); $player = 'youku'; } else { echo "\n++ {$v} ++\n"; continue; } $return[] = array($player, $v); } return $return; }