I am trying to use text from a page using file_get_contents. That page contains XML tree with all data. There exists a 'time' entry which is not current real time, i tried simpler way
$xml->forecast->time[day]
but that returns current date as because of PHP's time function i guess, and so, tree wont proceed any further like this:
<?php
$xmlString = file_get_contents("http://ift.tt/17Sq09b York&mode=xml&units=imperial&cnt=7");
$xml = new SimpleXMLElement($xmlString);
$loc = $xml->location->name.", ".$xml->location->country;
$day1 = date('Y-m-d', strtotime('+1 day'));
echo $xml->forecast->time[day1]->symbol['name'];
?>
No comments:
Post a Comment