get HTML element by attribute value in php

后端 未结 3 467
小蘑菇
小蘑菇 2021-02-04 12:41

I need to extract some data from a webpage with php. The part that I\'m interested in is structured similarly to this:



        
3条回答
  •  轮回少年
    2021-02-04 13:07

    Make two array

    $fruits=array();
    $animals=array();
    

    t and in loop when you get .

    if(target=='fruit') {
       array_push($fruits,$valueofelement);
    
    } else if ($target=='animal') {
       array_push($animals,$valueofelement);
    }
    

提交回复
热议问题