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:
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
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://
withhttp://
in your image link and your problem should be solved.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?