Привет, у меня были проблемы с API погоды Google с ошибками. Предупреждение: simplexml_load_string () [function.simplexml-load-string]: Entity: строка 2: ошибка синтаксического анализатора ....
Я пыталсяиспользовать сценарий основного автора (думая, что это был мой отредактированный сценарий), но все же у меня возникают эти ошибки, я попробовал 2 //komunitasweb.com/2009/09/showing-the-weather-with-php-and-google-weather-api /
и
// tips4php.net/2010/07/local-weather-with-php-and-google-weather/
Странная частьиногда он исправляет себя, затем снова возвращается к ошибке, которой я пользуюсь уже несколько месяцев, без каких-либо проблем, это произошло вчера.Также демонстрационная страница авторов работает, но у меня есть тот же точный код, любая помощь, пожалуйста.
это мой сайт http://j2sdesign.com/weather/widgetlive1.php
@ Майк Я добавил ваш код
<?
$xml = file_get_contents('http://www.google.com/ig/api?weather=jakarta'); if (! simplexml_load_string($xml)) { file_put_contents('malformed.xml', $xml); }
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=jakarta');
$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
?>
и составил список ошибок, ноКажется, я не вижу ошибки, потому что она исправляет себя, затем через некоторое время снова возвращается к ошибке
вот содержимое файла
<?php include_once('simple_html_dom.php'); // create doctype $dom = new DOMDocument("1.0");
// display document in browser as plain text
// for readability purposes //header("Content-Type: text/plain");
// create root element
$xmlProducts = $dom->createElement("products");
$dom->appendChild($xmlProducts);
$pages = array( 'http://myshop.com/small_houses.html', 'http://myshop.com/medium_houses.html', 'http://myshop.com/large_houses.html' ) foreach($pages as $page) { $product = array(); $source = file_get_html($page); foreach($source->find('img') as $src) { if (strpos($src->src,"http://myshop.com") === false) { $product['image'] = "http://myshop.com/$src->src"; } } foreach($source->find('p[class*=imAlign_left]') as $description) { $product['description'] = $description->innertext; } foreach($source->find('span[class*=fc3]') as $title) { $product['title'] = $title->innertext; } //debug perposes! echo "Current Page: " . $page . "\n"; print_r($product); echo "\n\n\n"; //Clear seperator } ?>