$url = 'the web address I want to get the first and second numbers close to $' ;
$str = file_get_contents($url);
preg_match_all('/ ([$]) *(\d+(:?.\d+)?)/', $str, $matches, PREG_SET_ORDER);
$i=0;
foreach ($matches as $val) {
if($i==0) $first=$val[2] ;
if($i==3) $second=$val[2] ;
$i++;
}
$bad_symbols = array(",", "."); $first = str_replace($bad_symbols, "", $first);
$bad_symbols = array(",", "."); $second = str_replace($bad_symbols, "", $second);
echo $first . "</br>";
echo $second;
es funktionierte gut bis gestern was könnte das Problem sein?PHP Code Scraping eine URL plötzlich nicht mehr funktioniert
Haben Sie sich das Ergebnis von file_get_contents ($ url) angesehen? Vielleicht verändert die Website, die Sie scrapen, etwas. – nos
Was ist der genaue Fehler, den Sie bekommen? –
Also, was ist das Problem? Was macht es jetzt? – EFraim