如何正确抓取 HTML 文档中显示的图像并将其提供给 PHP 以作为图像二进制文件读取。我没有直接访问图像文件的权限。我试图抓取的图像通过 PHP 使用 HTML 提供给客户端,并以 HTML 格式打印,并使用<img>
标签显示图像。src 只是指向我当前所在页面的链接。该链接是一个 GET 请求。
链接如下所示:
GETIMAGE.php?type=small&path=/path/to/image.png
这不会返回具有图像 MIME 类型的实际图像。而是显示图像的 HTML。
我无权访问 GETIMAGE.php 文件中的源代码。这是加密的,因为我使用的是获得许可的门户解决方案。
这是从 GETIMAGE.php 脚本返回的源代码:
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>GETIMAGE.php (80×112)</title>
<style type="text/css"></style>
</head>
<body style="margin: 0px;">
<img style="-webkit-user-select: none" src="http://portal.craftnordic.com/PORTAL/GETIMAGE.php?type=small&path=Path/To/Image.png">
</body>