dongmou2389 2013-03-20 17:26
浏览 23
已采纳

从其他站点提供图像时出错

Basically what I want to do is have a section on my site, where you provide the username of a user, example: NOTCH

Where it then goes to the minecraft host and finds the user's skin. "Skin Stealer" if you like.

However I'm getting an error and have no idea how to get around it..

<?php
if ($_GET['user'])
{
$user = $_GET['user'];

if(trim($user) == '')
{
    die('No username entered!');
}

$user = preg_replace('/\s+/', '', $user);

header('Content-Type: image/png');
$picture = '<img src="http://s3.amazonaws.com/MinecraftSkins/$user.png">';
$getpicture = file_get_contents("$picture");
echo $picture
}
?>

The HTML is just a basic form which reads the php page called 'mcskin.php'

  • 写回答

2条回答 默认 最新

  • donglang1976 2013-03-20 17:28
    关注

    If using file_get_contens you just need the url:

    $picture = "http://s3.amazonaws.com/MinecraftSkins/$user.png";
    

    Also change

    $getpicture = file_get_contents("$picture");
    

    to

    $getpicture = file_get_contents($picture);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 access中怎么分割分别获取一下图中的值
  • ¥15 keras_tcn已经安装成功,还是显示ModuleNotFoundError: No module named 'keras_tcn'
  • ¥15 类图中关联与聚合的区别
  • ¥15 ENVI高分五号去除云层的方法
  • ¥15 16进制数据如何得到奇偶校验位
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题