回答編集履歴
1
書き間違い
answer
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
```php
|
2
2
|
<?php
|
3
3
|
//対象ファイルはこちら
|
4
|
-
$file = "
|
4
|
+
$file = "読み取るページのURL";
|
5
5
|
//ファイルソースを文字列として所得
|
6
6
|
$file_content = file_get_contents($file);
|
7
7
|
//その中に画像パスがあるか検索します
|
8
|
-
preg_match_all('/<img.*src\s*=\s*[\"|\'](.*?)[\"|\'].*>/i',
|
8
|
+
preg_match_all('/<img.*src\s*=\s*[\"|\'](.*?)[\"|\'].*>/i', $file_content, $img_path_list);
|
9
9
|
header('Content-type: image/jpeg');
|
10
|
-
//表示します
|
10
|
+
// 表示します
|
11
|
+
// 自分の場合こうなりましたが、配列の中身が違うこともあります。
|
11
|
-
$img_path_list[1][0] = 'http://
|
12
|
+
$img_path_list[1][0] = 'http://xxxx.co.jp' . $img_path_list[1][0];
|
12
13
|
|
13
14
|
readfile($img_path_list[1][0]);
|
14
15
|
|