php - Using the library Simple_html_dom, it is necessary to close a "session" of file_get_html? -
php - Using the library Simple_html_dom, it is necessary to close a "session" of file_get_html? -
developed method value page, pass array of links method , returning value of each link. problem returns lastly value of given link, ignoring other links. must perform "closure" method send links other processes? follows method of processing , insertion:
for($i=0;$i<count($link);$i++){ $id=explode("/",$link[$i]); $id=$id[3]; $url=(string)$link[$i]; $data=$listadao->getdatacur($id); // seta os dados //echo "id>".$id." url> ".$url." date>".$data; $datasetterlista = $listadao->datasetter($lista,$id,$url,$data); //insere os dados $listadao->insertdata($datasetterlista); $insert = true;`
public function getdatacur($id){ $user=$id; $url="http://lattes.cnpq.br/".$user; $html= file_get_html($url); echo $html; $informacoes= $html->find('ul[class=informacoes-autor]'); foreach ($informacoes $inf) { $divinf=$inf->find('li'); $date= explode(" em ", $divinf[1]); $date=$date[1]; $values= explode("/",$date); $ano=explode("<",$values[2])[0]; $mes=$values[1]; $dia=$values[0]; $date=$ano."-".$mes."-".$dia; homecoming $date; } }
php
Comments
Post a Comment