• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file_get_html函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_get_html函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_html函数的具体用法?PHP file_get_html怎么用?PHP file_get_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_get_html函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($strUrl, $strJqClass = null, $strJqSetupFunc = null, $strQcClass = null, $strQcBaseClass = 'QPanel')
 {
     $this->hasDisabledProperty = false;
     $html = file_get_html($strUrl);
     if ($strJqClass === null) {
         $nodes = $html->find('h1.entry-title');
         $strJqClass = preg_replace('/ .*/', '', $nodes[0]->plaintext);
     }
     parent::__construct($strJqClass, $strJqSetupFunc, $strQcClass, $strQcBaseClass);
     $htmlOptions = $html->find('section[id=options] div.api-item');
     foreach ($htmlOptions as $htmlOption) {
         $type = $this->add_option($htmlOption);
         if ($this->is_event_option($type)) {
             $this->add_event($htmlOption, $type);
         }
     }
     $htmlEvents = $html->find('section[id=events] div.api-item');
     foreach ($htmlEvents as $htmlEvent) {
         $this->add_event($htmlEvent);
     }
     $htmlMethods = $html->find('section[id=methods] div.api-item');
     $this->reset_names();
     foreach ($htmlMethods as $htmlMethod) {
         $this->add_method($htmlMethod);
     }
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:26,代码来源:jq_control_gen-v1.9.php


示例2: getDpdOrderTracking

 public function getDpdOrderTracking()
 {
     $consignment = $this->getRequest()->getParam('consignment', 15502405041348.0);
     $link = 'http://www.dpd.co.uk/tracking/quicktrack.do?search.consignmentNumber=' . $consignment . '&search.searchType=16&search.javascriptValidated=0&appmode=guest';
     try {
         $html = file_get_html($link);
     } catch (Exception $e) {
         var_dump($e);
     }
     $Status = "Vide";
     $target_script = "Vide";
     foreach ($html->find('script') as $html_script) {
         if (strstr($html_script->outertext, "var trackCode =")) {
             $target_script = $html_script->outertext;
         }
     }
     $pattern = "/var trackCode = \\'(.*?)\\';*/";
     preg_match($pattern, $target_script, $matches);
     $data = array();
     $data['Status'] = $html->find('td[class=app-light-row-one app-table-indent] div[id=' . $matches[1] . '_text]', 0)->plaintext;
     $data['Parcel_No'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 0)->plaintext;
     $data['Reference'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 1)->plaintext;
     $data['consignment'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 2)->plaintext;
     $data['Post_Code'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 3)->plaintext;
     $data['Collected_Date'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 4)->plaintext;
     $data['Service'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 5)->plaintext;
     $data['Delivery_Status'] = $html->find('td[class=app-light-row-one app-border-top app-data-row]', 6)->plaintext;
     $trackingtable = $html->find('table[id=parceldetail]', 0)->outertext;
     $data['trackingtable'] = str_replace("SPICERS LTD", "WAREHOUSE", $trackingtable);
     return $data;
 }
开发者ID:remiebeling,项目名称:Hwg_Attributemanager,代码行数:31,代码来源:View.php


示例3: collectData

 public function collectData(array $param)
 {
     $page = 0;
     $tags = '';
     if (isset($param['p'])) {
         $page = (int) preg_replace("/[^0-9]/", '', $param['p']);
         $page = $page - 1;
         $page = $page * 50;
     }
     if (isset($param['t'])) {
         $tags = urlencode($param['t']);
     }
     $html = file_get_html("http://mspabooru.com/index.php?page=post&s=list&tags={$tags}&pid={$page}") or $this->returnError('Could not request Mspabooru.', 404);
     foreach ($html->find('div[class=content] span') as $element) {
         $item = new \Item();
         $item->uri = 'http://mspabooru.com/' . $element->find('a', 0)->href;
         $item->postid = (int) preg_replace("/[^0-9]/", '', $element->getAttribute('id'));
         $item->timestamp = time();
         $item->thumbnailUri = $element->find('img', 0)->src;
         $item->tags = $element->find('img', 0)->getAttribute('alt');
         $item->title = 'Mspabooru | ' . $item->postid;
         $item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: ' . $item->tags;
         $this->items[] = $item;
     }
 }
开发者ID:snroki,项目名称:rss-bridge,代码行数:25,代码来源:MspabooruBridge.php


示例4: ExtractContent

 function ExtractContent($url)
 {
     $html2 = file_get_html($url);
     $text = $html2->find('div.column', 0)->innertext;
     $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
     return $text;
 }
开发者ID:Nomane,项目名称:rss-bridge,代码行数:7,代码来源:DauphineLibereBridge.php


示例5: collectData

 public function collectData(array $param)
 {
     $html = '';
     $link = 'http://www.leboncoin.fr/annonces/offres/' . $param[r] . '/?f=a&th=1&q=' . $param[k];
     $html = file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404);
     $list = $html->find('.list-lbc', 0);
     if ($list === NULL) {
         return;
     }
     $tags = $list->find('a');
     foreach ($tags as $element) {
         $item = new \Item();
         $item->uri = $element->href;
         $title = $element->getAttribute('title');
         $content_image = $element->find('div.image', 0)->find('img', 0);
         if ($content_image !== NULL) {
             $content = '<img src="' . $element->find('div.image', 0)->find('img', 0)->getAttribute('src') . '" alt="thumbnail">';
         }
         $date = $element->find('div.date', 0)->find('div', 0) . $element->find('div.date', 0)->find('div', 1) . '<br/>';
         $detailsList = $element->find('div.detail', 0);
         for ($i = 1; $i < 4; $i++) {
             $line = $detailsList->find('div', $i);
             $content .= $line;
         }
         $item->title = $title . ' - ' . $detailsList->find('div', 3);
         $item->content = $content . $date;
         $this->items[] = $item;
     }
 }
开发者ID:httsan,项目名称:rss-bridge,代码行数:29,代码来源:LeBonCoinBridge.php


示例6: parseRss

 public function parseRss()
 {
     $channel = Xml::toArray(Xml::build($this->args[0])->channel);
     $items = $channel['channel']['item'];
     $list = $this->PinterestPin->find('list', array('fields' => array('id', 'guid')));
     $data = array();
     foreach ($items as $item) {
         if (!in_array($item['guid'], $list)) {
             $html = file_get_html($item['guid']);
             $image = $html->find('img.pinImage', 0);
             if (is_object($image)) {
                 $data[] = array('guid' => $item['guid'], 'title' => $item['title'], 'image' => $image->attr['src'], 'description' => strip_tags($item['description']), 'created' => date('Y-m-d H:i:s', strtotime($item['pubDate'])));
             }
         }
     }
     if (!empty($data)) {
         if ($this->PinterestPin->saveAll($data)) {
             $this->out(__d('pinterest', '<success>All records saved sucesfully.</success>'));
             return true;
         } else {
             $this->err(__d('pinterest', 'Cannot save records.'));
             return false;
         }
     }
     $this->out(__d('pinterest', '<warning>No records saved.</warning>'));
 }
开发者ID:adderall,项目名称:CakePHP-Pinterest-Plugin,代码行数:26,代码来源:PinterestShell.php


示例7: CADExtractContent

 function CADExtractContent($url)
 {
     $html3 = file_get_html($url);
     preg_match_all("/http:\\/\\/cdn2\\.cad-comic\\.com\\/comics\\/cad-\\S*png/", $html3, $url2);
     $img = implode($url2[0]);
     return $img;
 }
开发者ID:AlmightyFrog,项目名称:rss-bridge,代码行数:7,代码来源:CADBridge.php


示例8: CoinDeskExtractContent

 function CoinDeskExtractContent($url)
 {
     $html2 = file_get_html($url);
     $text = $html2->find('div.single-content', 0)->innertext;
     $text = strip_tags($text, '<p><a><img>');
     return $text;
 }
开发者ID:Nomane,项目名称:rss-bridge,代码行数:7,代码来源:CoinDeskBridge.php


示例9: collectData

 public function collectData(array $param)
 {
     $html = '';
     if (isset($param['q'])) {
         /* keyword search mode */
         $this->request = $param['q'];
         $html = file_get_html('https://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnError('No results for this query.', 404);
     } else {
         $this->returnError('You must specify a keyword (?q=...).', 400);
     }
     $emIsRes = $html->find('div[id=ires]', 0);
     if (!is_null($emIsRes)) {
         foreach ($emIsRes->find('li[class=g]') as $element) {
             $item = new Item();
             // Extract direct URL from google href (eg. /url?q=...)
             $t = $element->find('a[href]', 0)->href;
             $item->uri = '' . $t;
             parse_str(parse_url($t, PHP_URL_QUERY), $parameters);
             if (isset($parameters['q'])) {
                 $item->uri = $parameters['q'];
             }
             $item->title = $element->find('h3', 0)->plaintext;
             $item->content = $element->find('span[class=st]', 0)->plaintext;
             $this->items[] = $item;
         }
     }
 }
开发者ID:snroki,项目名称:rss-bridge,代码行数:27,代码来源:GoogleSearchBridge.php


示例10: collectData

 public function collectData(array $param)
 {
     $html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404);
     foreach ($html->find('div.blog-post') as $element) {
         $item = new Item();
         $temp = $element->find('h1 a', 0);
         $titre = html_entity_decode($temp->innertext);
         $url = $temp->href;
         $temp = $element->find('div.blog-post-content', 0);
         // retrieve .gif instead of static .jpg
         $images = $temp->find('p img');
         foreach ($images as $image) {
             $img_src = str_replace(".jpg", ".gif", $image->src);
             $image->src = $img_src;
         }
         $content = $temp->innertext;
         $auteur = $temp->find('i', 0);
         $pos = strpos($auteur->innertext, "by");
         if ($pos > 0) {
             $auteur = trim(str_replace("*/", "", substr($auteur->innertext, $pos + 2)));
             $item->name = $auteur;
         }
         $item->content .= trim($content);
         $item->uri = $url;
         $item->title = trim($titre);
         $this->items[] = $item;
     }
 }
开发者ID:j0k3r,项目名称:rss-bridge,代码行数:28,代码来源:LesJoiesDuCodeBridge.php


示例11: getContentSsc

 public function getContentSsc($link)
 {
     $data = file_get_html($link);
     $table1 = $data->find('table', 0);
     $content = '<table>';
     $content .= '<tbody>';
     foreach ($table1->find('tr') as $tr) {
         if ($tr->find('th', 0)) {
             $content .= '<tr>';
             $content .= '<th>';
             $content .= $tr->find('th', 0)->plaintext;
             $content .= '</th>';
             $content .= '<td>';
             if ($tr->find('td', 0)->find('a', 0)) {
                 $content .= '<a target="_blank" href="' . $tr->find('td', 0)->find('a', 0)->href . '">' . $tr->find('td', 0)->plaintext . '</a>';
             } else {
                 $content .= $tr->find('td', 0)->plaintext;
             }
             $content .= '</td>';
             $content .= '</tr>';
         }
     }
     $content .= '</tbody>';
     $content .= '</table>';
     return $content;
 }
开发者ID:nguyennghiem1205,项目名称:Wss,代码行数:26,代码来源:NewsTable.php


示例12: collectData

 public function collectData(array $param)
 {
     $html = '';
     $baseUri = 'http://www.superbwallpapers.com';
     $this->category = $param['c'] ?: '';
     // All default
     $this->resolution = $param['r'] ?: '1920x1200';
     // Wide wallpaper default
     $num = 0;
     $max = $param['m'] ?: 36;
     $lastpage = 1;
     // Get last page number
     $link = $baseUri . '/' . $this->category . '/9999.html';
     $html = file_get_html($link);
     $lastpage = min($html->find('.paging .cpage', 0)->innertext(), ceil($max / 36));
     for ($page = 1; $page <= $lastpage; $page++) {
         $link = $baseUri . '/' . $this->category . '/' . $page . '.html';
         $html = file_get_html($link) or $this->returnError('No results for this query.', 404);
         foreach ($html->find('.wpl .i a') as $element) {
             $thumbnail = $element->find('img', 0);
             $item = new \Item();
             $item->uri = str_replace('200x125', $this->resolution, $thumbnail->src);
             $item->timestamp = time();
             $item->title = $element->title;
             $item->thumbnailUri = $thumbnail->src;
             $item->content = $item->title . '<br><a href="' . $item->uri . '">' . $thumbnail . '</a>';
             $this->items[] = $item;
             $num++;
             if ($num >= $max) {
                 break 2;
             }
         }
     }
 }
开发者ID:httsan,项目名称:rss-bridge,代码行数:34,代码来源:SuperbWallpapersBridge.php


示例13: getPlayStoreVersion

 public static function getPlayStoreVersion($packageName)
 {
     $url = "https://play.google.com/store/apps/details?id=" . $packageName;
     $html = file_get_html($url);
     $ret = $html->find('div[itemprop=softwareVersion]');
     return $ret[0]->plaintext;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:7,代码来源:MobileApps.php


示例14: collectData

 public function collectData(array $param)
 {
     $link = 'http://www.monde-diplomatique.fr';
     $html = file_get_html($link) or $this->returnError('Could not request MondeDiplo. for : ' . $link, 404);
     foreach ($html->find('div.laune') as $element) {
         $item = new Item();
         $item->uri = 'http://www.monde-diplomatique.fr' . $element->find('a', 0)->href;
         $item->title = $element->find('h3', 0)->plaintext;
         $item->content = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
         $this->items[] = $item;
     }
     $liste = $html->find('div.listes', 0);
     // First list
     foreach ($liste->find('li') as $e) {
         $item = new Item();
         $item->uri = 'http://www.monde-diplomatique.fr' . $e->find('a', 0)->href;
         $item->title = $e->find('a', 0)->plaintext;
         $item->content = $e->find('div.dates_auteurs', 0)->plaintext;
         $this->items[] = $item;
     }
     foreach ($html->find('div.liste ul li') as $element) {
         if ($element->getAttribute('class') != 'intrapub') {
             $item = new Item();
             $item->uri = 'http://www.monde-diplomatique.fr' . $element->find('a', 0)->href;
             $item->title = $element->find('h3', 0)->plaintext;
             $item->content = $element->find('div.dates_auteurs', 0)->plaintext . ' <br> ' . $element->find('div.intro', 0)->plaintext;
             $this->items[] = $item;
         }
     }
 }
开发者ID:httsan,项目名称:rss-bridge,代码行数:30,代码来源:MondeDiploBridge.php


示例15: bible_gateway_available_versions

function bible_gateway_available_versions()
{
    include_once 'simple_html_dom.php';
    $html = file_get_html("http://www.biblegateway.com");
    if (empty($html)) {
        return false;
    }
    $select = $html->find('select[name=qs_version]', -1);
    if (empty($select)) {
        return false;
    }
    $versionnames = array();
    $currentlang = '';
    $options = $select->children;
    foreach ($options as $option) {
        if ($option->class == 'lang') {
            $currentlang = $option->value;
            continue;
        }
        // for some reason the english language section is deliniated by NIV not EN
        if ($currentlang != 'NIV') {
            continue;
        }
        $versionname = str_replace('&nbsp;', '', $option->innertext);
        $versionnames[$option->value] = $versionname;
    }
    return $versionnames;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:28,代码来源:biblelib.php


示例16: updateJSON

function updateJSON()
{
    $list = array();
    foreach (range('a', 'z') as $alphabet) {
        array_push($list, $alphabet);
    }
    array_push($list, "numeric");
    $space = '';
    for ($x = 0; $x <= 3; $x++) {
        $space = $space . "&nbsp;";
    }
    $movieMapping = array();
    foreach ($list as $alphabet) {
        $html = file_get_html('http://www.songspk.link/' . $alphabet . '_list.html');
        foreach ($html->find('div[class="catalog-album-holder"]') as $divElement) {
            foreach ($divElement->find('a') as $hrefElement) {
                $innerValue = trim($hrefElement->innertext);
                $hrefValue = $hrefElement->href;
                if (strlen($innerValue) > 1) {
                    $innerValue = preg_replace("/\\t/", "", $innerValue);
                    $movieMapping[trim($innerValue)] = trim($hrefValue);
                }
            }
        }
        //break;
    }
    $json = json_encode($movieMapping, true);
    $file = fopen("data.json", "w");
    file_put_contents("data.json", $json);
    fclose($file);
    //echo $json;
    echo "data.json Created!!";
}
开发者ID:sahil2232,项目名称:Musake,代码行数:33,代码来源:updateData.php


示例17: accept_terms_get_cookies

function accept_terms_get_cookies($terms_url, $button = 'Next', $postfields = array())
{
    $dom = file_get_html($terms_url);
    foreach ($dom->find('input[type=hidden]') as $data) {
        $postfields = array_merge($postfields, array($data->name => $data->value));
    }
    foreach ($dom->find("input[value={$button}]") as $data) {
        $postfields = array_merge($postfields, array($data->name => $data->value));
    }
    $curl = curl_init($terms_url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
    curl_setopt($curl, CURLOPT_HEADER, TRUE);
    $terms_response = curl_exec($curl);
    curl_close($curl);
    // get cookie
    // Please imporve it, I am not regex expert, this code changed ASP.NET_SessionId cookie
    // to ASP_NET_SessionId and Path, HttpOnly are missing etc
    // Example Source - Cookie: ASP.NET_SessionId=bz3jprrptbflxgzwes3mtse4; path=/; HttpOnly
    // Stored in array - ASP_NET_SessionId => bz3jprrptbflxgzwes3mtse4
    preg_match_all('/^Set-Cookie:\\s*([^;]*)/mi', $terms_response, $matches);
    $cookies = array();
    foreach ($matches[1] as $item) {
        parse_str($item, $cookie);
        $cookies = array_merge($cookies, $cookie);
    }
    return $cookies;
}
开发者ID:LoveMyData,项目名称:wingecarribee,代码行数:30,代码来源:scraper.php


示例18: collectData

 public function collectData(array $param)
 {
     $html = '';
     if (isset($param['u'])) {
         $this->request = $param['u'];
         if (strlen(preg_replace("/[^0-9a-f]/", '', $this->request)) == 24) {
             // is input the userid ?
             $html = file_get_html('http://www.whyd.com/u/' . preg_replace("/[^0-9a-f]/", '', $this->request)) or $this->returnError('No results for this query.', 404);
         } else {
             // input may be the username
             $html = file_get_html('http://www.whyd.com/search?q=' . urlencode($this->request)) or $this->returnError('No results for this query.', 404);
             for ($j = 0; $j < 5; $j++) {
                 if (strtolower($html->find('div.user', $j)->find('a', 0)->plaintext) == strtolower($this->request)) {
                     $html = file_get_html('http://www.whyd.com' . $html->find('div.user', $j)->find('a', 0)->getAttribute('href')) or $this->returnError('No results for this query', 404);
                     break;
                 }
             }
         }
         $this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
     } else {
         $this->returnError('You must specify username', 400);
     }
     for ($i = 0; $i < 10; $i++) {
         $track = $html->find('div.post', $i);
         $item = new \Item();
         $item->name = $track->find('h2', 0)->plaintext;
         $item->title = $track->find('h2', 0)->plaintext;
         $item->content = $track->find('a.thumb', 0) . '<br/>' . $track->find('h2', 0)->plaintext;
         $item->id = 'http://www.whyd.com' . $track->find('a.no-ajaxy', 0)->getAttribute('href');
         $item->uri = 'http://www.whyd.com' . $track->find('a.no-ajaxy', 0)->getAttribute('href');
         $this->items[] = $item;
     }
 }
开发者ID:snroki,项目名称:rss-bridge,代码行数:33,代码来源:WhydBridge.php


示例19: NiceMatinExtractContent

 function NiceMatinExtractContent($url)
 {
     $html2 = file_get_html($url);
     $text = $html2->find('figure[itemprop=associatedMedia]', 0)->innertext;
     $text .= $html2->find('div[id=content-article]', 0)->innertext;
     return $text;
 }
开发者ID:httsan,项目名称:rss-bridge,代码行数:7,代码来源:NiceMatinBridge.php


示例20: strip_link

function strip_link($inputFile, $inputFileLocation)
{
    $infile_final = $inputFileLocation . $inputFile;
    // get DOM from URL or file
    $html = file_get_html($infile_final);
    $header_reg = $html->find('h2', 0)->plaintext;
    $header_post = $html->find('h2', 1)->plaintext;
    $table = $html->find('table', 0);
    $boxScoreGames = $table->find('a');
    $links = array();
    if ($header_reg == "Regular Season") {
        foreach ($boxScoreGames as $rec) {
            if (preg_match("/games/", $rec)) {
                //strip everything but the link out of the string (pissed i did it this way)
                $rec = preg_replace('/<a href="/', '', $rec) . " ";
                $rec = preg_replace('/">(W|L)(.*)/', '', $rec) . "\n";
                $links[] = $rec;
            }
        }
        $table = $html->find('table', 1);
        $boxScoreGames = $table->find('a');
    }
    if ($header_post == "Postseason") {
        foreach ($boxScoreGames as $rec) {
            if (preg_match("/games/", $rec)) {
                //strip everything but the link out of the string (pissed i did it this way)
                $rec = preg_replace('/<a href="/', '', $rec) . " ";
                $rec = preg_replace('/">(W|L)(.*)/', '', $rec) . "\n";
                $links[] = $rec;
            }
        }
    }
    return $links;
}
开发者ID:scapista,项目名称:football-stats,代码行数:34,代码来源:content.php



注:本文中的file_get_html函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_get_mimetype函数代码示例发布时间:2022-05-15
下一篇:
PHP file_get_field函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap