简体   繁体   中英

How can I use the roblox image API to show an image from a url paramater in php?

I have been trying to get an image thumbnail from the ROBLOX API in php. The image works if I just put in the image in the code, but using a URL parameter, it doesn't work. Here is my code:

header('Content-type: image/jpeg;');
$p = $_GET['image_url'];
$a = file_get_contents($p);
echo $a;

The kind of link this is is http://www.roblox.com/asset-thumbnail/image?assetId=(AssetId)&width=420&height=420&format=png

Please Help!

$cURLConnection = curl_init();

curl_setopt($cURLConnection, CURLOPT_URL, 'http://www.roblox.com/asset-thumbnail/image?assetId=(AssetId)&width=420&height=420&format=png');

curl_setopt($ch, CURLOPT_HTTPHEADER, 'Content-type: image/jpeg;');

$roblox= curl_exec($cURLConnection);

curl_close($cURLConnection);

$jsonArrayResponse - json_decode($roblox);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM