Need Help Get Text Using CURL

by 4 replies
5
Hello all Warrior,
Can you help me ow to get content list from my web ?
please check this result :
Code:
http://linevin.com/db/curl.php
this for content :
Code:
http://linevin.com/db/data.txt
I need result like this :
Code:
http://domain1.com
http://domain2.com
http://domain3.com
http://domain4.com
This my php file :
PHP Code:
<?php
function bacaHTML($url){
     
$data = curl_init();
     
curl_setopt($data, CURLOPT_RETURNTRANSFER, 1);
     
curl_setopt($data, CURLOPT_URL, $url);
     
$hasil = curl_exec($data);
     
curl_close($data);
     return 
$hasil;
}

$kodeHTML =  bacaHTML('http://linevin.com/db/data.txt');
$pecah = explode("<C01>", $kodeHTML);
$pecahLagi = explode('</C01>', $pecah[1]);
foreach (
$pecah as $key => $pecah) {
echo 
$pecahLagi[0];
echo 
'<br/>';
}
?>
Thanks
#programming #curl #text
  • $kodeHTML = bacaHTML('http://linevin.com/db/data.txt');
    preg_match_all("/https?:\/\/[^<]+/", $kodeHTML, $pecah, PREG_SET_ORDER);
    foreach ($pecah as $pecah0) {
    echo $pecah0[0];
    echo '<br/>';
    }
  • Thats strange I'll look into it now for you.

    are you files even uploaded correctly?
  • Nothing strange there, the code is wrong, it just repeats the first match $pecahLagi[0] over and over.
    • [1] reply
    • i think this from my code..
      thanks for your code my friend..
      working great..

      solved........

Next Topics on Trending Feed