当前位置: 首页>>代码示例>>PHP>>正文


PHP file_get_html函数代码示例

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


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


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