samedi 6 avril 2019

web scraping does not work only on this site

I'm using the same code to get the price of different web pages (7 in particular), all work perfect, but in 1 I can not get any data, could you tell me if it is impossible, if the page has any protection? Thanks in advance.

$source = file_get_contents("https://www.cyberpuerta.mx/Computo-Hardware/Discos-Duros-SSD-NAS/Discos-Duros-Internos-para-PC/Disco-Duro-Interno-Western-Digital-Caviar-Blue-3-5-1TB-SATA-III-6-Gbit-s-7200RPM-64MB-Cache.html");

preg_match("'<span class=\"priceText\">(.*?)</span>'", $source, $price);

echo $price[1];

I hope this result: $869.00

This code only works badly on the website shown in the code.




Aucun commentaire:

Enregistrer un commentaire