php - Using Curl to get remote page source how to echo only one line of the code based on its number -


i working n getting source code of remote page url of remote page got dynamically url user click according arrays array('event_id', 'tv_id', 'tid', 'channel') : use code below who;e page source , works great.

<?php $keys = array('event_id', 'tv_id', 'tid', 'channel'); // order matter $newurl = 'http://lsh.streamhunter.eu/static/popups/'; foreach ($keys $key)     $newurl.= empty($_request[$key])?0:$_request[$key];  $newurl.='.html';     function get_data($newurl)      {         $ch = curl_init();        $timeout = 5;        //$useragent = "mozilla/5.0 (windows; u; windows nt 5.1; en-us)applewebkit/525.13 (khtml, gecko) chrome/0.x.y.z safari/525.13.";        $useragent = "ie 7 – mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; .net clr 1.1.4322; .net clr 2.0.50727; .net clr 3.0.04506.30)";       curl_setopt($ch, curlopt_useragent, $useragent);       curl_setopt($ch, curlopt_failonerror, true);       curl_setopt($ch, curlopt_followlocation, true);       curl_setopt($ch, curlopt_autoreferer, true);       curl_setopt($ch, curlopt_timeout, 10);       curl_setopt($ch,curlopt_url,$newurl);       curl_setopt($ch,curlopt_returntransfer,1);       curl_setopt($ch,curlopt_connecttimeout,$timeout);       $data = curl_exec($ch);       curl_close($ch);       return $data;      }      $html = get_data($newurl);      echo $html  ?> 

the trick here want echo line no 59 of code how so?

in code using file_get_contents instead of get_data function removed example.

<?php     $keys = array('event_id', 'tv_id', 'tid', 'channel'); // order matter     $newurl = 'http://lsh.streamhunter.eu/static/popups/';     foreach ($keys $key)         $newurl.= empty($_request[$key])?0:$_request[$key];      $newurl.='.html';       $html = file_get_contents($newurl);     $html = explode("\n",$html);     echo $html[58];  ?> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -