Click here to Skip to main content
16,019,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below method calls the google api for getting the weather conditions for specific location.

But I am getting The remote server returned an error: (407) Proxy Authentication Required

When calling bolded and underlined below in the code:

Please reply faster it is urgent for me.

I think some config settings to be changed for accessing it can i know the config settings if i am correct.
C#
public Conditions GetCurrentConditions(string location)
       {
           Conditions conditions = new Conditions();
           XmlDocument xmlConditions = new XmlDocument();
           xmlConditions.Load(string.Format("http://www.google.com/ig/api?weather={0}", location));

           if (xmlConditions.SelectSingleNode("xml_api_reply/weather/problem_cause") != null)
           {
               conditions = null;
           }
           else
           {
               conditions.City = xmlConditions.SelectSingleNode("/xml_api_reply/weather/forecast_information/city").Attributes["data"].InnerText;
               conditions.Condition = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/condition").Attributes["data"].InnerText;
               conditions.TempC = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_c").Attributes["data"].InnerText;
               conditions.TempF = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_f").Attributes["data"].InnerText;
               conditions.Humidity = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/humidity").Attributes["data"].InnerText;
               conditions.Wind = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/wind_condition").Attributes["data"].InnerText;
           }

           return conditions;
       }
Posted
Updated 13-Apr-12 16:43pm
v3
Comments
[no name] 13-Apr-12 22:45pm    
It's only urgent to you. None of us are paid to do any of this so telling us "it's urgent" or "send me codez" is rude and insulting.

1 solution

Your problem message pretty much states the issue and what to do.
You are going through a proxy firewall and you are not supplying the credentials for getting through. Check the Google API for defining your proxy credentials.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900