Link to home
Start Free TrialLog in
Avatar of walker6o9
walker6o9

asked on

Is it possible with php to grab html information from a div based on the div id?

Is it possible with php to grab html information from a div based on the div id?
ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you tell us a little about the application?  For example, are you reading the HTML from a web site from another server?
Avatar of walker6o9
walker6o9

ASKER

From the same folder off the same server.
Use file_get_contents() to read the data:

$str = file_get_contents('page.html');

http://php.net/manual/en/function.file-get-contents.php
You can use file_get_contents() to read the HTML into a variable like "$str" in the example above.  There are some DOM functions available in PHP, but if all you need is the HTML between two DIV tags, then cxr's example is likely to give you the fastest results.

Best regards, ~Ray