I'm trying to fetch a value contained in a tag ( span ) located in another domain using PHP and JavaScript. There are cases where I can get the required value but most of the value returned is null . I believe that when I give file_get_contents
to search for span, and it does not appear, it is because it needs the scripts referring to the mount of the value.
Has anyone had a similar situation and solved the problem?
Here is the code I'm using:
$regex = '/\<span class="special-price-value"(.*?)?\>(.|\n)*?\<\/span\>/i';
$url = file_get_contents("http://link.com.br");
preg_match_all($regex, $url, $scripts);
print_r($scripts);