This question already has an answer here:
I wanna extract some html from page Y
for example site is
<head>xxxx</head>
<body>....<div id="ineedthis_code"> </div> ...</body>
it is possible to do this file_get_contents ?! i need only that div nothing else
Without using a special library (which is the best way in most cases), you can use the explode-function:
Please note, it's only an example without error handling. It also works onlny on a special case; not if the html structure ist changing. Even simple spaces can break this code. So you should better use a parsing library ;-)