amchiimast
New Member
I am working in Yii+extjs. i am creating weather module. I want to retrieve weather information from ipaddress of user. i got reference code from website="http://www.geoplugin.com/examples".As per mentioned there, i had created getweather function as=\[code\] public function actionGetWeather() { $user_ip = $_SERVER['REMOTE_ADDR']; //The Data Science Toolkit URL $url = 'http://www.datasciencetoolkit.org/ip2coordinates/'; //Find the user's location from their IP. //*** You need the get_data function from the sample code $raw_geocode = json_decode( get_data( $url . $user_ip) ); //Check if the user is in the US if ('US' === $raw_geocode->$user_ip->country_code) { //If yes, store their zip code in a variable, and print it $zip_code = $raw_geocode->$user_ip->postal_code; printf('<p>Your zip code is: %s</p>', $raw_geocode->$user_ip->postal_code); } else { //If the user isn't in the US, set a sip code that will work. $zip_code = '97211'; //and print an error printf('<p>Sorry, this app does not work in %s.</p>', $raw_geocode->$user_ip->country_name); } //Print the raw data for debugging. printf('<pre>%s</pre>', print_r($raw_geocode, true)); }\[/code\]i had included ParseXml class in my project with code as=\[code\]class ParseXml {var $xmlStr;var $xmlFile;var $obj;var $aArray;var $timeOut;var $charsetOutput;function ParseXml() {}/** * @param String xmlString xml string to parsing */function LoadString($xmlString) { $this->xmlStr = $xmlString;}/** * @param String Path and file name which you want to parsing, * Also, if