zoukankan      html  css  js  c++  java
  • stock抓取基本资料

    use GoutteClient;
    use GuzzleHttpClient as GuzzleClient;
    include './vendor/autoload.php';
    
    
    $client = new Client();
    $crawler = $client->request('GET', 'http://f10.eastmoney.com/f10_v2/CoreConception.aspx?code=sz000005');
    //$crawler = $client->click($crawler->selectLink('Sign in')->link());
    //$form = $crawler->selectButton('Sign in')->form();
    //$crawler = $client->submit($form, array('login' => 'fabpot', 'password' => 'xxxxxx'));
    $crawler->filter('.summary')->each(function ($node) {
        print $node->text()."
    ";
    });
    //var_dump($crawler);

    composer require fabpot/goutte

     

    匹配两个class

    html : <div class=”class1 class2″>
    php  : $crawler->filter(‘div.class1.class1’);

    匹配id

    html : <div id=”hello”>
    php  : $crawler->filter(‘div#hello’);

    图片

    html : <img src=”http://www.lhzcl.com/image.png”>
    php  : $crawler->filter(‘img’)->attr(‘src’);

    内嵌html

    这个我常用来检测匹配规则是否正确
    
    html : <div class=”catchMeIfYouCan”><span id=”hello”>Hello</span>world</div>
    php  : $crawler->filter(‘catchMeIfYouCan’)->html();

    http://api.symfony.com/3.2/Symfony/Component/DomCrawler/Crawler.html#method_image


    雄安新区:http://stock.gtimg.cn/data/get_hs_xls.php?id=pt021323&type=1&metric=chr
  • 相关阅读:
    几种常见排序算法
    62.Android之各分辨率定义的图片规格
    MVC
    EasyUI datebox 只读和取值
    WebForm带有图片的验证码
    WebForm水印照片
    ajax完整结构
    jquery简单动画
    webform数据导出
    WebForm 发送邮箱
  • 原文地址:https://www.cnblogs.com/nowphp/p/6738605.html
Copyright © 2011-2022 走看看