I was trying to do web scraping for my personal webpage, using the bio and pics from a website profile (http://about.me/fernandocaldas) so whenever I change that profile the content in my web bio will also do. The desired values are between
<script type="text/json" class="json user" data-scope="view_profile" data-lowercase_user_name="fernandocaldas">
and
</script>
Here is my code:
$thtml = file_get_contents('http://about.me/fernandocaldas');
$matchval = '/\<script type=\"text\/json\" class=\"json.*?>(.*?)\<\/script\>/i';
preg_match($matchval, $thtml, $match);
var_dump($match);
if($match){
echo "match!\n";
foreach($match[1] as $val)
{
echo $val."<br>";
}
}
But the result is always array(0) {}
for the var_dump
.