Fetching data from a remote server has become a very common task these days. Unless you are very new to web programming, you must have, at some point, written code to fetch something from a remote server, be it JSON, XML, text or even an image. Most PHP developers are used to using cURL to perform such tasks. However, there’s a better alternative: the Guzzle HTTP client. It has a more intuitive API, and using it means writing less code.

In this screencast, I’m going to show you how to download an RSS feed using Guzzle. You can find the code sample for this screencast on GitHub.

Loading the player…

jwplayer(“video-5902”).setup({
image: “https://d3rj1gznkm47xj.cloudfront.net/e251bebd-28e0-4823-831f-f1861b80ccec.png”,
sources: [
{
file: “https://d3rj1gznkm47xj.cloudfront.net/f94e24f0889a813135188adc8dcc0708.mp4”,
label: “SD”
},
{
file: “https://d3rj1gznkm47xj.cloudfront.net/b2615de4deb5c05b1815a8c5692a5b74.mp4”,
label: “HD”
},
],
tracks: [
{
file: “http://djdvv9xnh2mt5.cloudfront.net/f1bbaad6-e8c6-4afc-a76d-8ab0ead96dbb.srt”,
“default”: true
}
],
aspectratio: “16:9”,
width: “100%”,
height: “480px”,
fallback: true,
primary: “flash”,
streaming: false,
analytics: {
enabled: false,
cookies: false
},
captions: {
back: false,
fontsize: 12
},
advertising: {
client: “googima”,
schedule: {
“myAds”: {
“offset”: “pre”,
“tag”: “https://pubads.g.doubleclick.net/gampad/ads?sz=855x483u0026iu=/7448792/Videou0026cust_params=[post_id]%3Dstaging%26channel%3D[channel]u0026impl=su0026gdfp_req=1u0026env=vpu0026output=xml_vast2u0026unviewed_position_start=1u0026url=[url]/u0026description_url=[description_url]u0026correlator=[timestamp]”
}
}
}
});

Continue reading %Watch: Fetch Remote Data Using Guzzle%

Source: SitePoint