Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7049081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:58:09+00:00 2026-05-28T02:58:09+00:00

I just want to read out the google weather api xml with that code

  • 0

I just want to read out the google weather api xml with that code but it returns a 500. Any ideas why?

<?php
 $url = "http://www.google.com/ig/api?weather=Moskva&hl=en";
 $xml = simplexml_load_string(utf8_encode(file_get_contents($url)));
 echo $xml->weather->current_conditions->temp_c->attributes()->data;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:58:10+00:00Added an answer on May 28, 2026 at 2:58 am

    Separate the lines out and introduce a try / catch block as follows :

    try {
      $url = "http://www.google.com/ig/api?weather=Moskva&hl=en";
      $temp1 = file_get_contents($url);
      $temp2 = utf8_encode($temp1);
      $xml = simplexml_load_string($temp2);
      echo $xml->weather->current_conditions->temp_c->attributes()->data;
    } catch (Exception $e) {
       echo 'Caught exception: ',  $e->getMessage(), "\n";
    }
    

    what happens then ?

    Updated

    Your response was due to the ip address your are coming from …. this was the response :

    http://www.google.com/sorry/?continue=http://www.google.com/ig/api%3Fweather%3DMoskva%26hl%3Den

    typing the response URL into a browser gives this :

    Our systems have detected unusual traffic from your computer network.
    This page checks to see if it’s really you sending the requests, and
    not a robot. Why did this happen?

    IP address: 90.214.41.66 Time: 2012-01-06T21:35:24Z URL:
    http://www.google.com/ig/api?weather=Moskva&hl=en

    Enter the URL in a browser and complete the CAPTCHA – should be sorted then

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want read-only check boxes to be greyed out, but display their checked/unchecked status
Just want to know how to read an attribute of a parent node from
I already read many article about this issue in here, SO. I just want
Just want to know if there other optional wrapper framework available that generate client
I just want my apache to register some of my predefined environment so that
I just want a simple tool that will help me quickly write scripts/packages that
I've figured out CUBE as just generating all the permutations, but I am having
Any Google search on PHP ical just brings up phpicalendar and how to parse
I have been struggling to figure out the fscanf formatting. I just want to
I'm just messing around with the Factual API but I don't fully understand how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.