Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

how to fetch data from other site in php ?

i want to data form another site in my website

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

Can you elaborate more? Is this an API you're using? How will the data be fetched? Are you getting a JSON file you will parse in PHP?

I used weather underground's API before. When someone loads your page, your web application makes a request to WU's server, with parameters in the URL like the location, how long of a forecast you want, etc. It returns a JSON file, that you parse in PHP, and than bring in that information bit by bit.

They had code examples on the API site that really helped make it easy. Does that help?

yai, i want to bring data using json file ,it can fetch image and video content also ?