php - file_get_contents() and preg_match_all issue -


i using file_get_contents($url) turn entire webpage string. use preg_match_all change words /user/ /member/ feature members. example:

$url = "http://www.example.com/profile.php"; $page = file_get_contents($url); preg_match_all('/user\/(.*?)/i', $page, $search);    $total = count($search[0]); for($i=0; $i<$total; $i++) {    if($search[1][$i] == 1) {     $user_type = '/member/'.$search[1][$i];   }   $page = str_replace($search[0][$i], $user_type, $page); } 

my problem is, if place above codes /profile.php, page keep loading forever. how should do? please help!


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -