| | |
| Stránka: 1 z 1
| [ Príspevkov: 7 ] | |
Autor | Správa |
---|
Registrovaný: 09.03.08 Prihlásený: 22.12.10 Príspevky: 356 Témy: 85 Bydlisko: Topoľčany |
Prosim vas cim by sa dala nahradit funkcia fopen a by ten kod fungoval? totizto mi to vypisuje zase chybu ze funkcia je na servery vypnuta.... Kód: <?php function getWeatherRSS($weatherLink){ if ($fp = fopen($weatherLink, 'r')) { $content = ''; while ($line = fread($fp, 1024)) { $content .= $line; } }
return $content; }
function processWeather($wurl){ $wrss = getWeatherRSS($wurl); $temp = '-'; $tempu = ''; $city = ''; if (strlen($wrss)>100){ // Get temperature unit C or F $spos = strpos($wrss,'yweather:units temperature="')+strlen('yweather:units temperature="'); $epos = strpos($wrss,'"',$spos); if ($epos>$spos){ $tempu = substr($wrss,$spos,$epos-$spos); }
$spos = strpos($wrss,'yweather:wind chill="')+strlen('yweather:wind chill="'); $epos = strpos($wrss,'"',$spos); if ($epos>$spos){ $temp += substr($wrss,$spos,$epos-$spos); } else { $temp = '-'; } // Get city name $spos = strpos($wrss,'yweather:location city="')+strlen('yweather:location city="'); $epos = strpos($wrss,'"',$spos); if ($epos>$spos){ $city = substr($wrss,$spos,$epos-$spos); }
} return $city.' '.$temp.' °'.$tempu; }
echo processWeather('http://xml.weather.yahoo.com/forecastrss?p=FRXX0076&u=c').;
?>
_________________ FCSpartak Trnava |
|
Registrovaný: 20.11.07 Prihlásený: 18.01.09 Príspevky: 2929 Témy: 116 | Napísal dadmtb: 29.12.2008 13:23 | |
|
Kód: $news_dir = dir("weather"); while($news_file = $news_dir->read()) { ... }
nieco taketo?
|
|
Registrovaný: 09.03.08 Prihlásený: 22.12.10 Príspevky: 356 Témy: 85 Bydlisko: Topoľčany | Napísal autor témy kaidžas: 29.12.2008 13:45 | |
|
myslel si to takto? Kód: function getWeatherRSS($weatherLink){ if ($news_dir = dir("weather")); { $content = ''; while($news_file = $news_dir->read()) { $content .= $line; } }
return $content; }
_________________ FCSpartak Trnava |
|
Registrovaný: 20.11.07 Prihlásený: 18.01.09 Príspevky: 2929 Témy: 116 | Napísal dadmtb: 29.12.2008 13:58 | |
|
Kód: if ($fp = dir($weatherLink)) { $content = ''; while ($line = $ft->read()) { $content .= $line; }
neako takto myslim ze by to malo byt
// a toto je obsah ten funkcie getWeatherRSS
|
|
Registrovaný: 09.03.08 Prihlásený: 22.12.10 Príspevky: 356 Témy: 85 Bydlisko: Topoľčany | Napísal autor témy kaidžas: 29.12.2008 14:21 | |
|
no zase toto:
Kód: Warning: dir() [function.dir]: URL file-access is disabled in the server configuration in /domains1/xxx/public/www_root/pocasie.php on line 4
Warning: dir(http://weather.yahoo.com/Poprad-Slovakia/LOXX0005/forecast.html?unit=c) [function.dir]: failed to open dir: no suitable wrapper could be found in /domains1/xxx/public/www_root/pocasie.php on line 4 - °
_________________ FCSpartak Trnava |
|
Registrovaný: 28.12.08 Prihlásený: 12.01.09 Príspevky: 78 Témy: 0 |
..pouzi fsockopen
|
|
Registrovaný: 13.11.07 Prihlásený: 20.08.16 Príspevky: 1702 Témy: 0 | Napísal chrono: 30.12.2008 1:11 | |
|
kaidžas píše: ... Zase sa ťa musím opýtať to, čo som sa ťa už pýtal. Máš dôvod, prečo nechceš používať curl?
http://www.pcforum.sk/post-vp501023.html#501023
Funkcia curl_get_contents robí presne to isté, čo robí funkcia getWeatherRSS (len namiesto file používa curl).
|
|
| Stránka: 1 z 1
| [ Príspevkov: 7 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| FOPEN pomoc! v PHP, ASP | 3 | 650 | 24.10.2009 13:56 rooobertek | | Fopen nefunguje v PHP, ASP | 2 | 485 | 22.11.2008 14:09 B.A.X.O | | [VYRIESENE] fopen inak v PHP, ASP | 1 | 442 | 02.03.2009 23:17 Blackshadow | | Vytvorenie noveho suboru fopen() v PHP, ASP | 1 | 396 | 13.10.2010 19:15 chrono | | Include alebo fOPEN - problem... v PHP, ASP | 3 | 338 | 21.10.2012 19:00 ondrejko0102 | | Súbor v C (fopen,fclosed) v Assembler, C, C++, Pascal, Java | 9 | 422 | 17.11.2011 14:14 Ďuri | | FreeHost s podporou PHP a funkcie FOpen(); FWrite; ... v Webhosting a servery | 2 | 1020 | 02.07.2008 17:37 Triminka | | počítadlo, chyby s fopen,fwrite..., iba pri include v PHP, ASP | 3 | 624 | 26.03.2011 21:02 davider137 | | fopen() - No connection could be made because the target machine actively refused it. v PHP, ASP | 0 | 376 | 24.01.2017 13:28 mackooo | | Počítanie CHAROV v súbore a re-write súboru použitím funkcií fopen(), fclose(), fgetc(), fputc() v Assembler, C, C++, Pascal, Java | 1 | 423 | 02.12.2020 10:00 focko |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|