5
I’m trying to get 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 mostly the returned value is null. I believe that when I give one file_get_contents
to fetch the span, and it does not appear, it is because it needs the scripts referring to the value mount.
Someone has already gone through a similar situation and managed to solve the problem?
Follow 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);
What form are you searching with PHP? using Domdocument or just File_get_contents?
– Wallace Maxters
file_get_content only, passing the link from where I want to search
– Henrique Costa
Could you put the part of your code that is in doubt? So it would make it easier to help you.
– Felipe Avelar
I added the block to my post!
– Henrique Costa
ah, you’re trying to pick up by PHP!
– Wallace Maxters
Yes, now, but had already tried for Javascript also haha
– Henrique Costa