Grabbing the WB menu from a non-WB php webpage

SaBRENT

Can anyone point me in the direction to pull a WB menu from a non-WB php webpage ?

Right now I am using file_get_contents() and preg_match() - I can't seem to get it to grab the whole menu it goes until a sub-menu page ends. this is what I am running:

Code (php) Select


   function get_main_menu($regex,$content) 
   { 
       preg_match($regex,$content,$matches); 
       return $matches[1]; 
   }

   $hv_content = file_get_contents('http://www.yourdomain.com/home.php');
   $main_menu = get_main_menu('/ul id="menu">(.*)<\/ul>/isU',$hv_content); 

   echo"$main_menu";



Agian the menu i am trying to pull has Sub-menus maybe it can be done with the way I have shown but I am unsure of how to finish the phrase right.