Jump to content

[SOLVED] Fetching Remote Data


PHPNewbie55

Recommended Posts

Here is my code...


$data = file_get_contents("http://www.someurl.com/");
preg_match('/">.*?<\/a><\/li>/',$data, $matches);

$fetchedtext = "".str_replace("\">", "", str_replace("</a></li>", "", $matches[0]))."";

print "$fetchedtext";

 

Here is my question:

 

This code only prints one set of "fetched text"...

is there a way to get this to loop through the page and get all instances..??

 

I have tried a "while" but it just grabs the same data over and over again... never ending..

 

Just curious..

Any help would be appreciated...  8)

Link to comment
https://forums.phpfreaks.com/topic/169668-solved-fetching-remote-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.