-4

I am trying to add information into my website that is drawn from another website. This is information like the current local temperature from weather.com or the current stock price from yahoo finance or the current exchange rate from some other site. I need the numbers, not just an iframe or screenshot.

Is this possible?

ToMakPo
  • 855
  • 7
  • 27

2 Answers2

1

Yes it is.

But you can't achieve it with pure HTML. You need use either a server-side scripting languages such as PHP or a client-side scripting language such as JavaScript. But JavaScript can cause problems because most browsers requests a Access-Control-Allow-Origin header. Yahoo's YQL (Yahoo Query Language) allows all requests from anywhere so you can use it. Yahoo has weather and currency (I don't know for sure)

acrosman
  • 12,814
  • 10
  • 39
  • 55
Emre Aydin
  • 569
  • 2
  • 16
1

So you basically have two options here. Find free or paid APIs and get the information from them such as this API for weather: http://openweathermap.org/api

The other option is called web-scraping which is basically just scanning the source code of a site with some kind of server side or client side programming language to find the data that you want. The data is usually wrapped in an HTML tag with a certain class or id that you can scan for.

I would suggest trying to go the API route first though because web-scraping is a grey area and it will easily break unless the website you are scraping never makes design/layout changes.

JoeyZero
  • 567
  • 5
  • 16