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


PHP scraperWiki::gb_postcode_to_latlng方法代码示例

本文整理汇总了PHP中scraperWiki::gb_postcode_to_latlng方法的典型用法代码示例。如果您正苦于以下问题:PHP scraperWiki::gb_postcode_to_latlng方法的具体用法?PHP scraperWiki::gb_postcode_to_latlng怎么用?PHP scraperWiki::gb_postcode_to_latlng使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scraperWiki的用法示例。


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

示例1: trim

            $id = trim($cols[0]->find('input', 0)->value);
            $name = trim($cols[0]->find('.resultName', 0)->plaintext);
            $url = html_entity_decode($cols[0]->find('.resultName', 0)->find('a', 0)->href);
            $address = trim($cols[0]->find('.resultAddress', 0)->plaintext);
            $postcode = trim($cols[0]->find('.resultPostcode', 0)->plaintext);
            $stars = sscanf($cols[1]->find('img', 0)->alt, "Food hygiene rating is '%d'");
            //$stars = str_replace("images/scores/", "", $cols[1]->find('img', 0)->src);
            $stars = $stars[0];
            if (!is_numeric($stars)) {
                $stars = "Exempt";
            }
            $premhtml = scraperWiki::scrape($url);
            $premdom = new simple_html_dom();
            $premdom->load($premhtml);
            $businesstype = $premdom->find('h1', 0)->plaintext;
            $date = $premdom->find('#ctl00_ContentPlaceHolder1_uxBusinessLastInspection', 0)->plaintext;
            $address1 = $premdom->find('#ctl00_ContentPlaceHolder1_uxBusinessAddress1', 0)->plaintext;
            $address2 = $premdom->find('#ctl00_ContentPlaceHolder1_uxBusinessAddress2', 0)->plaintext;
            $address3 = $premdom->find('#ctl00_ContentPlaceHolder1_uxBusinessAddress3', 0)->plaintext;
            $address4 = $premdom->find('#ctl00_ContentPlaceHolder1_uxBusinessAddress4', 0)->plaintext;
            $latlng = scraperWiki::gb_postcode_to_latlng($postcode);
            $prem = array('id' => $id, 'name' => html_entity_decode($name), 'address1' => html_entity_decode($address1), 'address2' => html_entity_decode($address2), 'address3' => html_entity_decode($address3), 'address4' => html_entity_decode($address4), 'postcode' => $postcode, 'businesstype' => $businesstype, 'rating' => $stars, 'url' => html_entity_decode($url), 'rssdate' => date("r", strtotime($date)));
            $date = date("c", strtotime($date));
            scraperwiki::save(array('id'), $prem, $date, $latlng);
        }
        # Those pesky form elements again!
        $viewstate = $dom->find('#__VIEWSTATE', 0)->value;
        $eventvalidation = $dom->find('#__EVENTVALIDATION', 0)->value;
        $page++;
    }
}
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:31,代码来源:gwynedd.php


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