Download Image From Steam Url PHP

I want to download image from url and add it to my wordpress page. Well everything is okay when url is like this :

www.domain.com/images/image.jpg

But I want to get image from steam market , and their image links look like this:

Read More
https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot7HxfDhjxszJemkV09-5gZKKkPLLMrfFqWdY781lteXA54vwxgbjrkc5ZD3wLNLGcFVrYl6GrAS2x7y7g8PvupidzyRmuCUl4H6IzkSpwUYbC6zHyEM/360fx360f

And when I call PHP function file_get_contents($url); It doesn’t return image.
So how can I retrieve image.
Thanks

Related posts

1 comment

  1. Your image link from Steam is using SSL. Using SSL in PHP requires a bit more setup than using a normal link. Replace the https:// with http:// in your image link and your problem should be solved.

    file_get_contents("http://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpot7HxfDhjxszJemkV09-5gZKKkPLLMrfFqWdY781lteXA54vwxgbjrkc5ZD3wLNLGcFVrYl6GrAS2x7y7g8PvupidzyRmuCUl4H6IzkSpwUYbC6zHyEM/360fx360f")
    

    If you absolutely must use SSL to load the image, you can read how to do that on this other Stack Overflow question: How to get file_get_contents() to work with HTTPS?

Comments are closed.