Serenissima Posted September 1, 2004 Share Posted September 1, 2004 Hi, I have a Dreamweaver templete with named editable regions. I want to use php to extract the information that has been put into the editable region. I have got the code for a page into a variable using the following: $webpage = "http://www.mydomain.com/thepage.htm"; $fp = fopen($webpage,"r"); $page =""; while (!feof($fp)) $page.=fgets($fp,1000); fclose($fp); And on the page is a chunk of code starting <!-- #BeginEditable "title" --> I want to retrieve the code that follows as far as <!-- #EndEditable --> I tried exploding $page into an array of words thusly: $page_array = explode(" ",$page); and had thought of looping through the array until I found #BeginEditable "title" then pulling out the following array elements until I got to #EndEditable, but for some reason the #BeginEditable isn't matching (if I loop through and echo each array element it doesn't appear. But if I echo $page and look at the source html it is!). I can find the position within the string of where it starts (using strpos) but as I don't know how long the code will be until the #EndEditable I can't use substr to pull it out. Does anybody have any ideas please? Quote Link to comment https://forums.phpfreaks.com/topic/1944-extracting-part-of-a-webpage/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.