[Solved] not scraping website with PHP [closed]


The reason why this isn’t working is because the actual website got a lot more between “Summary:” and the “<span class…”

What you could try (that seems to work) is to change it into the simpler form:

$contents=file_get_contents("http://www.weather-forecast.com/locations/San-Francisco/forecasts/latest");

preg_match('/<span class="phrase">(.*?)<\/s/', $contents,$matches);
print_r($matches[0]);

This will pick out more matches, but since we’re only interested in the first we can just pick that one out from the array.

1

solved not scraping website with PHP [closed]