function fetch_data_from_html($remote_page)
{
    // Returns an array of products and ratings
    $product_rating_arr = array();
    $html = get_html($remote_page);
    $dom = new domDocument();
    $dom->loadHTML($html);
    $dom->preserveWhiteSpace = false;
    $tables = $dom->getElementsByTagName('table');
    $table = $tables->item(0);
    $rows = $table->getElementsByTagName('tr');
    $i = 0;
    foreach ($rows as $row) {
        if ($i != 0) {
            $columns = $row->getElementsByTagName('td');
            $product = $columns->item(0)->textContent;
            $rating = $columns->item(1)->textContent;
            $image = $columns->item(2)->textContent;
            $var = $product . "__" . $image;
            $product_rating_arr[$var] = $rating;
        }
        $i += 1;
    }
    return $product_rating_arr;
}
function get_members($url)
{
    $html = get_html($url);
    if ($html === false) {
        echo 'connection error';
    } else {
        $oldSetting = libxml_use_internal_errors(true);
        libxml_clear_errors();
        $dom = new DOMDocument();
        $dom->loadHtml($html);
        $tbody = $dom->getElementsByTagName('tbody');
        $trs = $tbody[0]->getElementsByTagName('tr');
        global $parteinameFilter;
        $members = array();
        foreach ($trs as $tr) {
            $tds = $tr->getElementsByTagName('td');
            $link = $tds[0]->getElementsByTagName('a');
            $member = array('name' => $link[0]->nodeValue, 'link' => $link[0]->getAttribute('href'), 'partei' => str_replace($parteinameFilter, '', $tds[1]->nodeValue));
            $aze = str_replace(' ', '', htmlentities($tds[2]->nodeValue));
            if ($aze) {
                $member['amtszeitende'] = $aze;
            }
            $members[] = $member;
        }
        libxml_clear_errors();
        libxml_use_internal_errors($oldSetting);
        return $members;
    }
    return false;
}
function get_commitees($url)
{
    $html = get_html($url);
    if ($html === false) {
        echo 'connection error';
    } else {
        $oldSetting = libxml_use_internal_errors(true);
        libxml_clear_errors();
        $dom = new DOMDocument();
        $dom->loadHtml($html);
        $tbody = $dom->getElementsByTagName('tbody');
        $trs = $tbody[0]->getElementsByTagName('tr');
        $commitees = array();
        foreach ($trs as $tr) {
            $tds = $tr->getElementsByTagName('td');
            $link = $tds[0]->getElementsByTagName('a');
            if ($link->length > 0) {
                $commitee = array('name' => $link[0]->nodeValue, 'link' => $link[0]->getAttribute('href'));
            }
            $commitees[] = $commitee;
        }
        libxml_clear_errors();
        libxml_use_internal_errors($oldSetting);
        return $commitees;
    }
    return false;
}
Example #4
0
function parse_event_html($schedule_html, $event_url)
{
    $page_type = get_page_type($schedule_html);
    if ($page_type == WORLD_CURL) {
        $event = get_basic_event_information_wct($schedule_html, $event_url);
        $event->games = get_event_games_wct($event_url, $event);
        return $event;
    } else {
        if ($page_type == CCA) {
            $event = get_basic_event_information_cca($schedule_html, $event_url);
            $event->games = get_event_games_cca(get_html($event_url));
            return $event;
        }
    }
}
Example #5
0
function display_gallery_pagination($url = "", $totalresults = 0, $pageno = 1, $resultspp = 15, $display = true)
{
    //lookup total number of rows for query
    $configp['results_per_page'] = $resultspp;
    $configp['total_no_results'] = $totalresults;
    $configp['page_url'] = $url;
    $configp['current_page_segment'] = 4;
    $configp['url'] = $url;
    $configp['pageno'] = $pageno;
    $output = get_html($configp);
    if ($display == true) {
        echo $output;
    } else {
        return $output;
    }
}
Example #6
0
/**
 * function get_conversation()
 * This function gets the conversation format
 * @param  array $convoArr - the conversation array
 * @return array $convoArr
**/
function get_conversation($convoArr)
{
    $conversation = get_conversation_to_display($convoArr);
    runDebug(__FILE__, __FUNCTION__, __LINE__, "Processing conversation as " . $convoArr['conversation']['format'], 4);
    switch ($convoArr['conversation']['format']) {
        case "html":
            $convoArr = get_html($convoArr, $conversation);
            break;
        case "json":
            $convoArr = get_json($convoArr, $conversation);
            break;
        case "xml":
            $convoArr = get_xml($convoArr, $conversation);
            break;
    }
    return $convoArr;
}
Example #7
0
function get_event_games_wct($event_url, $event)
{
    $game_objects = array();
    $scores_url = $event_url . '&view=Scores&showdrawid=1';
    $scores_html = get_html($scores_url);
    $number_of_draws = get_number_of_draws_wct($scores_html->find(".linescoredrawlink"));
    for ($draw_id = 1; $draw_id <= $number_of_draws; $draw_id++) {
        $draw_url = $event_url . '&view=Scores&showdrawid=' . $draw_id;
        $html = get_html($draw_url);
        $page_type = get_page_type_wct($html);
        if ($page_type == WCT_EVENT_PAGE) {
            $game_objects = array_merge($game_objects, parse_wct_event_page($html, $event));
        } else {
            if ($page_type == ERROR) {
                echo "\n*****ERROR: Can't Determine Page Type****";
            }
            pause("");
        }
    }
    return $game_objects;
}
Example #8
0
/**
 * Функция выводит EPG с заданным каналом
 *
 * @param string $parsedChannel
 */
function Get_Channel_EPG($parsed_Channel_ID, $parsed_Announce_ID)
{
    global $content_dir;
    $path = "{$content_dir}/kulichki.net.{$parsed_Channel_ID}.html";
    if (!is_aktuell($path)) {
        get_html($parsed_Channel_ID, $path);
    }
    //get announce html
    $path_announce = "{$content_dir}/kulichki.net.{$parsed_Announce_ID}.announce.html";
    if (!is_aktuell($path_announce)) {
        get_html($parsed_Announce_ID, $path_announce);
    }
    parse_channel($path, $path_announce);
}
Example #9
0
<ul class="form">
<?
	// ========= CARGO =========
	get_html("charge");

	// ========= APELLIDO Y NOMBRE =========
	get_html("titular_lastfirstname");

	// ========= TELEFONO FIJO Y CELULAR =========
	get_html("titular_phones");

	// ========= TIPO Y NUMERO DE DOCUMENTO =========
	get_html("titular_document");

	// ========= CATCHA =========
	if( isset($_GET["show_catcha"]) ){	
		get_html("catcha");
	}
?>
</ul>

<div class="buttonRegister">
<? if( isset($_GET["coduser"]) ){?>
	<input type="button" value="Guardar" onclick="Registry.send('registry_club.php', 'edit', '<? echo $_GET["coduser"];?>');">
	<input type="reset" value="Reset">

<? }else{?>
	<input type="button" value="Registrarme" onclick="Registry.send('registry_club.php', 'new');">
<? }?>
</div>
Example #10
0
<?php

#req: http://www.380747.com/PolicyManage/GJPolicyList.aspx?Action=GetList&Page=1&callback=jQuery11110604594005504623_1437061376820&Platform=&Carrier=&PolicyID=&Flag=&DepName=&ArrName=&DepArea=&ArrArea=&DepCity=&ArrCity=&ProName=&Provider=&Share=&Office=&Auditing=&Record=&Asc=0&AscName=Updatetime&TicketFrom=&TicketTo=&GoFrom=&GoTo=&TicketType=&_=1437061376821
#rsp: PolicyManage/GJPolicyList_json.html
include 'InitPolicyList.php';
include 'Public.php';
judge_auth();
$arr_req = get_req();
#printf("REQUEST_METHOD: ".$_SERVER['REQUEST_METHOD']."\n");
#print_r($_GET);
#error_log("$g_today query now_running error. ".$arr_req["Action"]."\n",3,'/tmp/errors.log');
if ($arr_req["Action"] == null) {
    if ($arr_req["Page"] != null) {
        print get_html($arr_req["Page"]);
    } else {
        print get_html(1);
    }
} else {
    if ($arr_req["Action"] == "Auditing") {
        if ($arr_req["ID"] == null || $arr_req["ID"] == "" || $arr_req["Type"] == null || $arr_req["Type"] == "") {
            echo "NO";
            exit;
        }
        $arr_id = split('[,]', $arr_req["ID"]);
        $ids = "";
        for ($j = 0; $j < count($arr_id); $j++) {
            if ($ids != "") {
                $ids .= ",";
            }
            $ids .= "\"" . $arr_id[$j] . "\"";
        }
Example #11
0
<?php

include_once '../includes/main.php';
echo_bootstrap(get_html(), array('css' => 'portfolio'));
function get_html()
{
    return <<<HTML
\t\t<div id="nav-menu"></div>
HTML;
}
Example #12
0
<?php

include_once 'includes/main.php';
include_once 'includes/Client.php';
echo_bootstrap(get_html(), array('js' => 'add_client'));
function get_html()
{
    $client_inputs = array(array('id' => 'client_name', 'placeholder' => 'Client Name'), array('id' => 'alias', 'placeholder' => 'Client Acronym'));
    $html = <<<HTML
    <div id="add-client">
    <h2>Add Client</h2>
    <h3>Client Details</h3>
HTML;
    foreach ($client_inputs as $key => $input) {
        $autofocus = $key == 0 ? true : false;
        $html .= Client::createInput($input['id'], $input['placeholder'], array('autofocus' => $autofocus));
    }
    $html .= <<<HTML
  \t<h3>Project Details</h3>
HTML;
    $html .= Client::getProjectInput('1');
    $html .= <<<HTML
      <button class="add"><i class="fa fa-plus-circle"></i>Project</button>
      <button id="create" class="primary">Create</button>
    </div>
HTML;
    return $html;
}
Example #13
0
function get_event_format_wct($event_url)
{
    $event_html = get_html($event_url);
    $event_info_html = $event_html->find(".wctlight");
    $number_of_qualifiers = preg_replace("/[^0-9]/", "", substr($event_info_html[7]->plaintext, stripos($event_info_html[7]->plaintext, "(")));
    $event_type = $event_info_html[9]->plaintext;
    //echo "Number of qualifiers: " . $number_of_qualifiers;
    //echo "Event Type: " . $event_type;
    return new Format($event_type, $number_of_qualifiers);
}
Example #14
0
require 'config.php';
require 'function.php';
$fromurl = 'http://bt.doc5188.com';
$indexhtml = 'index.cache.html';
if (file_exists($indexhtml)) {
    $filetime = filemtime($indexhtml);
    $nowtime = time();
    if ($nowtime - $filetime > $config['cachetime']) {
        $content = get_html($fromurl, $config);
        echo $content;
        write_html($content, $indexhtml);
    } else {
        $content = file_get_contents($indexhtml);
        exit($content);
    }
} else {
    $content = get_html($fromurl, $config);
    echo $content;
    write_html($content, $indexhtml);
}
function get_html($siteurl, $config)
{
    $str = get_url_contents($siteurl);
    $str = str_replace('http://bt.doc5188.com', $config['siteurl'], $str);
    $str = str_replace('优搜磁力搜索', $config['title'], $str);
    $str = str_replace('/statics/', $config['erji'] . 'statics/', $str);
    $str = preg_replace('/<title>([\\s\\S]*?)<\\/title>/i', '<title>' . $config['title'] . ' - 做最全的资源搜索引擎 - 没有搜不到,只有想不到!</title>', $str);
    $str = preg_replace('/<div style="display:none;">([\\s\\S]*?)<\\/div>/i', '<div class="foot">友情链接:' . $config['link'] . '</div><div style="display:none;">' . $config['tongji'] . '</div>', $str);
    $str = str_replace('action="/search"', 'action="' . $config['erji'] . 'search.php"', $str);
    return $str;
}
Example #15
0
 function download_playlist($tracks)
 {
     foreach ($tracks as $id) {
         if (!is_integer($id)) {
             continue;
         }
         $data = get_html('http://youtube.com/watch?v=' . $id);
         if ($data != '') {
             $this->download_track($data);
         }
     }
 }
Example #16
0
File: run.php Project: gto76/bets
            }
            if (!empty($player) && $points > 0 && $over > 0 && $under > 0) {
                $qd = $dbh->query("SELECT * FROM odds WHERE bookie_url = '{$bookie_url}' AND player_name = '{$player}' AND start_time = '{$time}'") or die($dbh->error . ' in ' . __FILE__ . ' line ' . __LINE__);
                $rd = $qd->fetch_assoc();
                if (is_null($rd)) {
                    $dbh->query("INSERT INTO odds (bookie_name, bookie_url, start_time, player_name, player_total, over, under, date_time) VALUES ('{$bookie_name}', '{$bookie_url}', '{$time}', '{$player}', " . $points . ", " . $over . ", " . $under . ", " . time() . ")") or die($dbh->error . ' in ' . __FILE__ . ' line ' . __LINE__);
                } else {
                    $dbh->query("UPDATE odds SET player_name = '{$player}', player_total = " . $points . ", over = " . $over . ", under = " . $under . ", date_time = " . time() . " WHERE id = " . $rd['id']) or die($dbh->error . ' in ' . __FILE__ . ' line ' . __LINE__);
                }
            }
        }
    }
}
/* <- planetwin365 */
/* -> dvoznak */
$str = get_html(dvoznak_url);
$html = str_get_html($str);
if (method_exists($html, 'find')) {
    if ($html->find('li#danas-sport-d_' . date('Y-m-d') . '-s_1-n_3970_i')) {
        foreach ($html->find('li#danas-sport-d_' . date('Y-m-d') . '-s_1-n_3970_i') as $li) {
            if ($li->find('a.s_item')) {
                foreach ($li->find('a.s_item') as $a) {
                    $player_url = 'http://dvoznak.com/' . $a->href;
                    $exec = shell_exec(phantomjs . ' --ignore-ssl-errors=true dvoznak.js "' . $player_url . '" "' . path . '/html/dvoznak.html" "' . user_agent . '"');
                    $player_html = str_get_html(file_get_contents(path . '/html/dvoznak.html'));
                    if (method_exists($player_html, 'find')) {
                        if ($player_html->find('div#nazivigraca')) {
                            $player = $dbh->real_escape_string(trim($player_html->find('div#nazivigraca', 0)->plaintext)) ?: '';
                        } else {
                            $player = '';
                        }
Example #17
0
            if ($row = $result->fetch_array()) {
                $arr_result = create_strategy_edit_item($row);
                $arr_result["ret"] = "OK";
                print get_html(json_encode($arr_result));
            } else {
                error_log("{$g_today} query strategy error. " . $mysqli->error . "\n", 3, './errors.log');
                printf("{$g_today} query strategy error. " . $mysqli->error . "\n");
                exit;
            }
            $result->close();
            $mysqli->close();
        } else {
            print get_html();
        }
    } else {
        print get_html();
    }
} else {
    if ($arr_req["Action"] == "GetAirportList") {
        #req: http://www.380747.com/PolicyManage/GJPolicyEdit.aspx?Action=GetAirportList&AreaLevel=0101010101&callback=jQuery111109532740074209869_1437057647685&_=1437057647689
        #res: jQuery111109532740074209869_1437057647685([{"text": "FUD-绥芬河机场", "value": "FUD"},{"text": "HEK-黑河机场", "value": "HEK"},{"text": "HRB-哈尔滨太平机场", "value": "HRB"},{"text": "JMU-佳木斯东郊机场", "value": "JMU"},{"text": "LDS-伊春林都机场", "value": "LDS"},{"text": "MDG-牡丹江海浪机场 ", "value": "MDG"},{"text": "NDG-齐齐哈尔三家子机场", "value": "NDG"},{"text": "OHE-漠河机场", "value": "OHE"},{"text": "YLN-依兰机场", "value": "YLN"},{"text": "JGD-加格达奇机场", "value": "JGD"},{"text": "DQA-大庆机场", "value": "DQA"}])
        #req: 亚洲(不含大陆): http://10.211.55.5/test_php/PolicyManage//GJPolicyEdit.php?Action=GetAirportList&AreaLevel=01&callback=jQuery111109700722498819232_1436879181111&_=1436879181119
        $id = intval($arr_req["AreaLevel"]);
        $callback = $arr_req["callback"];
        #printf("id: $id callback: $callback\n");
        $mysqli = sql_connect();
        $sql = "select type from three_code where id={$id}";
        $result = $mysqli->query("{$sql}");
        $arr_result = array();
        if (!$result) {
            error_log("{$g_today} query now_running error. " . $mysqli->error . "\n", 3, './errors.log');
Example #18
0
<?php

include_once 'includes/main.php';
include_once 'includes/Individual.php';
$post_data = isset($_REQUEST['post_data']) ? json_decode($_REQUEST['post_data'], true) : false;
if (isset($post_data)) {
    $individual_id = $post_data['individual_id'];
    $individual = new Individual($individual_id);
    $_SESSION['logged_in'] = true;
    $_SESSION['user'] = array('name_first' => $individual->find('name_first'), 'name_last' => $individual->find('name_last'), 'individual_id' => $individual_id, 'email' => $individual->find('email'));
}
echo_bootstrap(get_html(), array('css' => 'profile'));
function get_html()
{
    return <<<HTML
\t\t<main>
\t\t\t<h2>Welcome to your profile page</h2>
\t\t\t<p>Hello {$_SESSION['user']['name_first']}!</p>
\t\t\t<p>Welcome to your login page.</p>
\t\t</main>
HTML;
}
Example #19
0
function show_pdf($id_)
{
    define('K_PATH_IMAGES', dirname(__FILE__) . '/media/image/');
    define('PDF_HEADER_LOGO', 'header.png');
    define('PDF_HEADER_LOGO_WIDTH', 20);
    require_once dirname(dirname(__FILE__)) . '/includes/tcpdf/tcpdf.php';
    $html = get_html($id_);
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Ulteo OVD Administration Console ' . OVD_VERSION);
    $pdf->SetTitle('Archived session - ' . $id_);
    $pdf->SetSubject('Archived session - ' . $id_);
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Archived session - ' . $id_, 'Ulteo OVD Administration Console ' . OVD_VERSION);
    // set header and footer fonts
    $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    $pdf->AddPage();
    $pdf->writeHTML($html, true, false, true, false, '');
    $pdf->lastPage();
    $pdf->Output('Ulteo-OVD-Archived-session-' . $id_ . '.pdf', 'D');
    die;
}
Example #20
0
		}
		/* My own additions */
		.ui-datepicker-inline {
			background: white;
			padding: 5px;
		}
		.ui-datepicker-inline a {
			margin: 5px;
			text-decoration: underline;
		}
		.ui-datepicker-title {
			width: 50%;
			display: inline;
			font-weight: bold;
		}
		li {
			list-style-type: none;
		}
		li:before {
			content: '✔    ';
		}
		.excluded {
			color: #CCC;
		}
		.excluded:before {
			content: '✖    ';
		}
	</style>
<?php 
echo get_html('footer');
Example #21
0
        echo "<br>\n\r";
        print_r($url . "<br>\n\r");
        print_r($id . '------' . $i . '---------' . __LINE__ . "<br>\n\r");
        if (is_array($products)) {
            $result = array_merge($result, $products);
            if (count($result) > 440) {
                insert_database($result, $row['model'], $row['name'], $row['shundian_price'], $con);
                $result = [];
            }
        }
        print_r(count($result) . '---------------' . __LINE__ . "<br>\n\r");
        // 暂停30s
        sleep(5);
        ++$i;
        $url = "https://s.taobao.com/search?q=" . $row['model'] . "&ie=utf8&app=detailproduct&through=1&bcoffset=0&s=" . 44 * $i;
        $data = get_html($url, $row, $con);
        $products = $data[0]["products"];
    }
    if ($result) {
        insert_database($result, $row['model'], $row['name'], $row['shundian_price'], $con);
        // 成功插入的数据status设置为1
        $sql = "UPDATE `tb_product_list` SET `status` = '1' WHERE `id` = " . $row['id'];
        $retval = mysql_query($sql, $con);
        if (!$retval) {
            die('Could not connect: ' . mysql_error() . "   on line " . __LINE__ . "<br>\n\r");
        }
    }
    ++$id;
}
function get_html($url, $row, $con)
{
Example #22
0
			case "24":
			// ========= Datos Sport NATACIÓN =========
				// ========= Seleccionado =========	
						get_html("seleccionado");
				// ========= Nadando desde =========	
						get_html("nadando_desde");
				// ========= Nadando desde =========	
						get_html("entrenador");
    			// ========= Modalidad =========	
						get_html("modalidad");
				// ========= Rankings =========	
						get_html("rankings");
			// ========= Fin Datos Sport NATACIÓN =========
		    break;
			case "25":
			// ========= Datos Sport ESCALADA DEPORTIVA =========
				// ========= Años Escalando =========	
						get_html("anios_escalando");
    			// ========= Rankings =========	
						get_html("rankings");
				// ========= Modalidad =========	
						get_html("modalidad");
		    break;
		}
	die ();
	break;
	
		
}
die("ok");
?>
Example #23
0
<?php

/**
 * Created by PhpStorm.
 * User: TopSage
 * Date: 2015/12/9
 * Time: 18:34
 */
$htmlstr = get_html("https://s.taobao.com/search?q=BCD-293WB-S&ie=utf8&app=detailproduct&through=1");
echo $htmlstr;
function get_html($url)
{
    $ch = curl_init();
    // 设置浏览器的特定header
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Connection: keep-alive", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Upgrade-Insecure-Requests: 1", "DNT:1", "Accept-Language: zh-CN,zh;q=0.8,en-GB;q=0.6,en;q=0.4,en-US;q=0.2", "Cookie:cna=ecujDgxJEU8CAdrwlTLMuyK+; thw=cn; miid=7140089985405878683; v=0; alitrackid=www.taobao.com; lastalitrackid=login.taobao.com; _m_user_unitinfo_=center; swfstore=215194; uc3=nk2=AmkbKafOx9I%3D&id2=UU8PbnneKzSx&vt3=F8dAScPgs6rESw5%2BNVI%3D&lg2=Vq8l%2BKCLz3%2F65A%3D%3D; existShop=MTQ0OTU2NTEzOQ%3D%3D; lgc=axianzia; tracknick=axianzia; mt=np=&ci=3_1; skt=f2c6c4105e77cbd0; _cc_=UIHiLt3xSw%3D%3D; tg=0; _tb_token_=oaE7Go2oUk7Z962; whl=-1%260%260%261449568422819; cookie2=1c57c14d607abb81e85c05679f007c46; t=441f8ce4777a72bb7ea38953b39d0d4c; JSESSIONID=ECBB6328A062EBBE896A5C9B854D5334; _m_h5_tk=11e2be3c504d361fb530c7a1f447a5ca_1449634740417; _m_h5_tk_enc=636ea452721ecb60b7ecb1744c653678; l=AiUlE8sXvkMEjUFIkjKHa0NWte9eVdn0; x=e%3D1%26p%3D*%26s%3D0%26c%3D0%26f%3D0%26g%3D0%26t%3D0%26__ll%3D-1%26_ato%3D0; uc1=cookie14=UoWzUGIL8UVUmQ%3D%3D; isg=42486C6A8F68C6883C8B398697F593BC"));
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36');
    // 在HTTP请求头中"Referer: "的内容。
    curl_setopt($ch, CURLOPT_REFERER, "https://s.taobao.com/search?q=BCD-293WB-S&ie=utf8&app=detailproduct&through=1");
    curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate, sdch");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_TIMEOUT, 120);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //302redirect
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    $content = curl_exec($ch);
    if ($content === false) {
        echo 'Curl error: ' . curl_error($ch);
    }
Example #24
0
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <?php 
if ($page->template() == 'post') {
    ?>
        <meta name="description" content="<?php 
    $text = get_text($page->text());
    $text = strip_tags($text);
    $text = htmlspecialchars_decode($text);
    $text = preg_replace('/\\r|\\n/', ' ', $text);
    $text = preg_replace('/\\s+/', ' ', $text);
    if (mb_strlen($text) > 300) {
        $text = trim(mb_substr($text, 0, 300)) . '…';
    }
    $text = get_html($text);
    $text = trim($text);
    echo $text;
    ?>
">
        <?php 
} else {
    ?>
        <meta name="description" content="JS-Tricks.com provides tips, tricks, and techniques on JavaScript running on node.js and the browser in the form of snippets and tutorials.">
        <?php 
}
?>
        <?php 
if ($page->template() == 'home') {
    ?>
        <title>JS-Tricks.com</title>
Example #25
0
$blog = 'http://onvqf.over-blog.com/';
// Question 2 : Récupère le code source d'un site.
function get_html($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
    return curl_exec($ch);
}
// Je n'arrive pas à faire fonctionner la méthode libxml_use_internal_errors();
// Utilisation d'une alternative
error_reporting(0);
// Question 3 : Création de l'arbre DOM
$doc = new DOMDocument();
$doc->loadHTML(get_html($blog));
//echo $doc->saveHTML();
// Question 4 : Requête XPATH
$xpath = new DOMXPath($doc);
$articles = $xpath->query('//div[@class="article"]');
// Nombre d'articles
printf('%d articles trouvées : <br /><hr/>', $articles->length);
// Liste des articles
for ($i = 0; $i < $articles->length; $i++) {
    $article = $articles->item($i);
    $url = $xpath->evaluate('string(.//a/@href)', $article);
    $nom = $xpath->evaluate('string(.//a/@title)', $article);
    echo "Nom de l'article : {$nom} <br/>Lien : {$url}<br/><hr/>";
}
?>
    </body>
ini_set('memory_limit', '-1');
function get_html($url)
{
    $ch = curl_init();
    $timeout = 15;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$today = date("Y-m-d");
$url = 'http://checkerproxy.net/getProxy?date=' . $today;
$html = get_html($url);
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html);
libxml_clear_errors();
$textarea = $dom->getElementsByTagName("li");
$file = fopen("proxies.txt", "w");
foreach ($textarea as $value) {
    $class = $value->getAttribute('class');
    if (empty($class)) {
        $content = $value->nodeValue . "\n";
        fwrite($file, $content);
    }
}
fclose($file);
echo 'The proxy list file:proxies.txt are updated at ' . date("Y-m-d H:i:s") . "\n";
Example #27
0
//如果设置成0的话,就是永不过期。
set_time_limit(0);
$html = new simple_html_dom();
//$html->load_file('http://www.amazon.com/s/ref=sr_nr_p_n_size_browse-bin_0?fst=as%3Aoff&rh=n%3A172282%2Cn%3A541966%2Cn%3A565108%2Cp_n_feature_eighteen_browse-bin%3A6819965011%2Ck%3Alaptops%2Cp_n_size_browse-bin%3A7817234011&keywords=laptops&ie=UTF8&qid=1442896184&rnid=2242797011');
$htmlstr = get_html('http://weixinqun.com/group');
$html->load($htmlstr);
//$tab_head = $html->find('ul#tab_head li img[src]');
$first_href = $html->find('ul#tab_head li a', 1)->href;
echo "第一个列表URL:" . $first_href . "<br>";
$html->clear();
//
//$first_href = "/group?id=900298";
$groupstr = get_html('http://weixinqun.com' . $first_href);
$html->load($groupstr);
$first_qrcode_img_src = $html->find('div.cateNav img', 0)->src;
echo "第一张图片" . $first_qrcode_img_src . "<br>";
$next_href = $html->find('div.cateNav a.btn_orange', 1)->href;
//如果是第一页,下一个页面URL要取第一个按钮
if ($next_href == "") {
    $next_href = $html->find('div.cateNav a.btn_orange', 0)->href;
}
echo "下一页,页面URL:" . $next_href . "<br>";
for ($i = 0; $i < 5; $i++) {
    $groupstr = get_html('http://weixinqun.com' . $first_href);
    $html->load($groupstr);
    $first_qrcode_img_src = $html->find('div.cateNav img', 0)->src;
    echo $i . ":" . $first_qrcode_img_src . "<br>";
    $next_href = $html->find('div.cateNav a.btn_orange', 1)->href;
    $html->clear();
    $first_href = $next_href;
}
Example #28
0
    }
    if (time() - $mtime > $content_expired) {
        get_html($parsedChannel, 'sputnik', $path);
    } else {
        //print ( "File for channel #$parsedChannel is fresh");
    }
    //get announce html
    $path_announce = "{$content_dir}/kulichki.net.{$parsedChannel}.announce.html";
    $mtime_announce = filemtime($path_announce);
    if (file_exists($path)) {
        $mtime_announce = filemtime($path_announce);
    } else {
        $mtime_announce = 0;
    }
    if (time() - $mtime_announce > $content_expired) {
        get_html($parsedChannel, 'anons', $path_announce);
    } else {
        //print ( "File for announce of channel #$parsedChannel is fresh");
    }
    parse_channel($path, $path_announce);
} else {
    print 'channel is not defined' . PHP_EOL;
}
function parse_announce($path_announce)
{
    $EpgText = "";
    //"C S13.0E-318-9400-8208\r\n";
    $prevEpgEvent = "";
    $prevTimeStamp = 0;
    $prevShortDesc = "";
    $prevDesc = "";
Example #29
0
<?php

include 'PolicyManage/Public.php';
include 'InitNewMain.php';
judge_auth();
$arr_req = get_req();
print get_html($arr_req);
Example #30
0
<?php

include_once 'includes/main.php';
echo_bootstrap(get_html(), array('css' => 'index'));
function get_html()
{
    return <<<HTML
\t\t<div class="toggle-section next active"><i class="fa fa-chevron-down"></i></div>
\t\t<div class="section-container" id="Home">
\t\t\t<div class="center">
\t\t\t\t<div class="container">
\t\t\t\t\t<p class="title">Ryan Develops</p>
\t\t\t\t\t<p>Pragmatic, results-driven dev with a knack for getting things done.</p>
\t\t\t\t</div>
\t\t\t</div>
\t\t\t<div class="slideshow"></div>
\t\t</div>
\t\t<div class="main content">
\t\t\t<div class="section-container" id="About">
\t\t\t\t<div class="section">
\t\t\t\t\t<h1>About</h1>
\t\t\t\t\t<p>If you're in the market for a pragmatic developer with real world experience -- who understands the balance between business value and clean code -- you've come to the right place.</p>
\t\t\t\t\t<p>I offer full stack open-source development with additional experience in both version control and deployment. Whether you're looking for a single page website, or a massive application, I can handle your project with the highest of quality and efficiency.</p>
\t\t\t\t\t<p>I'm an iterative development kind of guy, who loves all things systems and processes. So, if you're looking for the kind of developer who can help push your product out the door -- with both style and reliability -- while also driving efficient and proven processes...look no further.</p>
\t\t\t\t\t<button id="go-to-email">Let's Connect</button>
\t\t\t\t</div>
\t\t\t</div>
\t\t\t<div class="section-container" id="Expertise">
\t\t\t\t<div class="section">
\t\t\t\t\t<h1>Expertise</h1>
\t\t\t\t\t<div class="table">