Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Caracorn's avatar

API: How do I get an image from another server safely?

Hello!

From an external API I get temporary the response of an url for a image on that server.

So I have to 'have' this image on my server within a short time.

How do I get it safely? I was told not to use the PHP function 'file_get_contents' or to set allow_url_fopen to "allowed".

Is there a safe way out of the box to get this image?

Many thanks

0 likes
2 replies

Please or to participate in this conversation.