从下拉简单的html dom抓取数据

时间:2019-08-11 03:27:03

标签: php

i am trying to scrape data from dropdown 

我不知道该怎么做

<div class="col-xs-10 col-lg-3">
  <SELECT NAME="month">
     <OPTION VALUE="ALL">ALL
      <OPTION VALUE="1" >Jan
      <OPTION VALUE="2" >Feb
      <OPTION VALUE="3" >Mar
      <OPTION VALUE="4" >Apr
      <OPTION VALUE="5" >May
      <OPTION VALUE="6" >Jun
      <OPTION VALUE="7" >Jul
      <OPTION VALUE="8" selected>Aug
      <OPTION VALUE="9" >Sep
      <OPTION VALUE="10" >Oct
      <OPTION VALUE="11" >Nov
      <OPTION VALUE="12" >Dec               
 </SELECT>
 </div>
this is the drapdown i want to get value and content and push those 2 to a array


include('simple_html_dom.php');
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_URL, "https://www.equibase.com/premium/eqbRaceChartCalendar.cfm?SAP=TN");
$htmlSource=curl_exec($curl);
//$ret = $htmlSource->find('.col-xs-10 col-lg-3');

$dom = new simple_html_dom(null, true, true, DEFAULT_TARGET_CHARSET, true, DEFAULT_BR_TEXT, DEFAULT_SPAN_TEXT);
$htmlSource=$dom->load($htmlSource, true, true);

 $element =  $html->find('.col-xs-10 col-lg-3',0)->find('option');     
 echo count($element);
        foreach($element as $elemen) {         
            echo "Display text:".($elemen->plaintext)."<br>"; 
            echo "value:".($elemen->value)."<br>";
        } 

这是我到目前为止所做的

有人可以帮助我从dropdwon中获取这些值和内容,并将该数据推入数组并显示在另一页中

0 个答案:

没有答案