SA-MP Forums Archive
How to get the Weather? HTTP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to get the Weather? HTTP (/showthread.php?tid=251747)



How to get the Weather? HTTP - tal_peretz - 28.04.2011

i tried to get the weather in my country....... that what i did -

PHP код:
HTTP(playeridHTTP_GET"weather.yahoo.com/israel/tel-aviv/tel-aviv-1968212/""""Weather"); 
PHP код:
forward Weather(data[]);
public 
Weather(data[])
{
scmToAll(red,data);
return 
1;

and thats showed me something not clear.. [not working]

so.. how ? thanks for helping


Re: How to get the Weather? HTTP - Vince - 28.04.2011

You need to extract the data you need, as the HTTP function fetches the whole page (try the 'View Source' function in your browser and you'll see what I mean) .. Use stfind if you know what you're looking for.


Re: How to get the Weather? HTTP - tal_peretz - 28.04.2011

ok i understand what you mean, but, how can I extract the data I need? I looked in the 'View Source' I found what i need but I don't know exactly what to take and what to do with that..


Re: How to get the Weather? HTTP - Michael@Belgium - 28.04.2011

Or else you can use this include

Quote:
Real weather
AddWeatherObserver

Creates a weather observer that updates the data for the url every specified milliseconds.

Parameters:
(url[], updatetime)
url[] The link to the wanted position from weather.yahoo.com.
updatetime Interval in ms in which the weather is checked (10 mins are more than enough for normal use).

Returns The observerid of the created observer, -1 if it could not be added.

Note: To get the URL, go to weather.yahoo.com and search for the town/area you want. Use the link up to the last slash (e.g. http://weather.yahoo.com/bahrain/cap...anama-1967057/)



Re: How to get the Weather? HTTP - tal_peretz - 28.04.2011

but i don't want to set the weather like in my country .. i just want to take the status of the weather that's all :\