亚马逊aws拒绝cURL访问



尝试使用cURL下载网络摄像头图像。

以下返回拒绝访问:

<?php
$url = 'http://s3-us-west-2.amazonaws.com/alertwildfire-data-public/Axis-CupertinoHills/latest_full.jpg';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
header('Content-type: image/jpeg');
echo $data;

URL来自以下链接:

http://www.alertwildfire.org/index.html

选择区域,然后查看网络摄像头,右键单击可查看图像。

您需要设置适当的"裁判";标题

示例:

curl_setopt($ch, CURLOPT_REFERER, "http://www.alertwildfire.org/blmnv/index.html?camera=Axis-Angel&v=81e002f");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Referer: http://www.alertwildfire.org/blmnv/index.html?camera=Axis-Angel&v=81e002f'
));

最新更新