Wednesday, January 31, 2018

laravel Goutte filter some of text is return right result while some is return nothing - development

laravel Goutte filter some of <td> text is return right result while some is return nothing

Hi i am using laravel Goutte package to crawl some specific data for data analysis in my project while i am applying the filter some of td is return the right result while some is not return result anyone have the idea please help my controller code is

namespace AppHttpControllers;

use IlluminateHttpRequest;
use Goutte;
use GoutteClient;
 use AppHttpRequests;
class MapController1 extends Controller
{
    //
  public function index()
   {

   $crawler = Goutte::request('GET', 'http://www.upsldc.org/real-time-data');
    $crawler->filter('body')->each(function ($node) {
      echo "<pre>";
      //var_dump($node->text());
      echo $node->filter('td')->eq(0)->text();
       echo $node->filter('td.up_schedule')->text();
       echo $node->filter('td')->eq(2)->text();

    });


   }
}

it is return Schedule (MW)Drawl (MW) but this echo $node->filter(‘td.up_schedule’)->text(); row is return nothing. Thanks in advance



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-goutte-filter-some-of-td-text-is-return-right-result-while-some-is-return-nothing/
via Lzo Media

No comments:

Post a Comment