please help in this yahoo weather api class

Discussion in 'PHP' started by crazy.works, Feb 19, 2009.

  1. #1
    hello,
    i was in the last 3 days online on the internet trying to embed the yahoo weather data in my site , and after long long search i got that class which i attached.

    i know the yahoo weather api work in that base
    http://weather.yahooapis.com/forecastrss?p=$zipcode&u=$unit

    but the problem is it is kind of complex class and iam not doing very well in the classes

    the author wrote in the beginning of the lass that

    /*
    *** TO USE ***
    $data = new weather;
    $data = $data->retrieve(areaCode, units);
    returns an array
    * All credit of the icons goes to whoever made them. *
    */

    but i still not able to load the data, so please have a look at the class and help me to load the weather data for city like new york ,area code = USNY0996

    thanks
     

    Attached Files:

    crazy.works, Feb 19, 2009 IP
  2. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    in the "retrieve()" function the class author uses a typecast to INT
    so the class only uses numeric zip codes or it casts to 0

    
       function retrieve($areaCode, $units, $debug=false) {
    
            $this->debug = $debug;
            $this->areaCode = (int) $areaCode;
            $this->units = $units;
            if(!$this->weatherData = $this->retrieveData()) {
    
    PHP:

    this class is built to use with numeric zipcodes I guess.

    
    $w=new weather;
    $data=$w->retrieve("10027", "F");
    print_r($data);
    
    PHP:
    removing the (int) typecast, you can use US****** codes and it does return data but that appears to use the yweather: namespace and might require a different parser.
     
    juust, Feb 20, 2009 IP
  3. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks alot :)
     
    crazy.works, Feb 22, 2009 IP