Beste,
Ik heb echt een vage fout normaal werkt dit script perfect en haalt die op wat ik nodig heb
net opeens werkte het niet meer en kreeg ik een vage foutmelding.
zie het script.
de foutmelding die ik krijg isPHP Code:
$query_explore = mysql_query("SELECT city FROM _city_weather_city") or die(mysql_error());
while ($query = mysql_fetch_object($query_explore)) {
$city = $query->city;
$xml = simplexml_load_file('http://www.google.com/ig/api?weather='.$city.'&hl=en');
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
foreach ($forecast_list as $forecast)
{
//alles mooi in de database zetten
mysql_query('INSERT INTO _city_weather_data (city, day_of_week, low, high, icon, con) VALUES ("'.$city.'", "'.$forecast->day_of_week['data'].'", "'.$forecast->low['data'].'", "'.$forecast->high['data'].'", "'.$forecast->icon['data'].'", "'.$forecast->condition['data'].'")') or die (mysql_error());
}
Iemand een oplossing hiervoor ? volgens mij is de server overload maar ik weet niet wat ik hier aan kan doen.Warning: simplexml_load_file(http://www.google.com/ig/api?weather=Chicago&hl=en) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable in /home/***/domains/***/public_html/weather.php on line 11
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://www.google.com/ig/api?weather=Chicago&hl=en" in /home/***/domains/***/public_html/weather.php on line 11
Alvast bedankt
- failed to open stream: HTTP request failed! HTTP/1.0 503
-
29-06-2011, 19:34 #1
- Berichten
- 154
- Lid sinds
- 15 Jaar
failed to open stream: HTTP request failed! HTTP/1.0 503
-
-
29-06-2011, 20:37 #2
- Berichten
- 548
- Lid sinds
- 16 Jaar
Re: failed to open stream: HTTP request failed! HTTP/1.0 503
Heb je gecontroleerd of die Google url nog bestaat?
-
29-06-2011, 21:30 #3
- Berichten
- 154
- Lid sinds
- 15 Jaar
Re: failed to open stream: HTTP request failed! HTTP/1.0 503
Natuurlijk dat is het eerste wat ik heb gedaan.
Link bestaat nog gewoon
-
29-06-2011, 23:03 #4
- Berichten
- 25
- Lid sinds
- 13 Jaar
Re: failed to open stream: HTTP request failed! HTTP/1.0 503
Probeer dit
PHP Code:$query_explore = mysql_query("SELECT city FROM _city_weather_city") or die(mysql_error());
while ($query = mysql_fetch_object($query_explore)) {
$city = $query->city;
$xml = simplexml_load_file('http://www.google.com/ig/api?weather='.$city.'&hl=en');
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
foreach ($forecast_list as $forecast)
{
//alles mooi in de database zetten
mysql_query('INSERT INTO _city_weather_data (city, day_of_week, low, high, icon, con) VALUES ("'.$city.'", "'.$forecast->day_of_week['data'].'", "'.$forecast->low['data'].'", "'.$forecast->high['data'].'", "'.$forecast->icon['data'].'", "'.$forecast->condition['data'].'")') or die (mysql_error());
}
}
-
30-06-2011, 21:37 #5
- Berichten
- 750
- Lid sinds
- 15 Jaar
Re: failed to open stream: HTTP request failed! HTTP/1.0 503
Tja al wel eens over nagedacht dat je server ip misschien wel geblokkeerd is?
Je haalt wel eerst alle steden uit je database om vervolgens deze op te vragen.
Mogelijke oplossing door middel van een sleep
PHP Code:<?php
$query_explore = mysql_query("SELECT city FROM _city_weather_city") or die(mysql_error());
while ($query = mysql_fetch_object($query_explore)) {
$city = $query->city;
$xml = simplexml_load_file('http://www.google.com/ig/api?weather='.$city.'&hl=en');
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
sleep(5); // Lelijke oplossing misshcien wel DE oplossing
foreach ($forecast_list as $forecast)
{
//alles mooi in de database zetten
mysql_query('INSERT INTO _city_weather_data (city, day_of_week, low, high, icon, con) VALUES ("'.$city.'", "'.$forecast->day_of_week['data'].'", "'.$forecast->low['data'].'", "'.$forecast->high['data'].'", "'.$forecast->icon['data'].'", "'.$forecast->condition['data'].'")') or die (mysql_error());
}
}
?>
Andere oplossing zou wezen om een wachtrij in de database te zetten en via middel van een cronjob welke bijvoorbeeld om de 2 minuten een stad ophaalt uit de wachtrij en deze naar google stuurt daar dan verwijderen uit de wachtrij en later deze weer vullen.Laatst aangepast door Raymond Nijland : 30-06-2011 om 21:53
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic