I want to get the data from a website, therefore I created the code below in php. The content which I want to get is inside a <div>
:
<div class="post-text" itemprop="text">
// Content I want to get
</div>
My PHP code is as follow:
<?php
$page = file_get_contents('http://somewebsite.com');
preg_match_all("/<div class=\"post-text\" itemprop=\"text\".*div>/", $page, $agent_name);
print_r($agent_name);
?>
But when I execute the code, it does not show anything on the page. The output I get is like:
Array ( [0] => Array ( ) )
Can someone tell me what I am doing wrong?