//$url = 'http://www.mysteryranch.com/Product%20Images/WS17%20Triple%20Bang%20Pouch_10-multicam-hero.jpg';
$url = 'http://www.mysteryranch.com/Product Images/WS17 Flash Bang Pouch_20-multicam-open.jpg';
// $url = str_replace( " ", '%20', $url );
//$response = file_get_contents($url);
//echo '<pre>';print_r($response);exit;
$response = wp_remote_get($url );
echo '<pre>';print_r($response);exit;
答案 0 :(得分:1)
它看起来像服务器过滤WordPress客户端。如果您更改用户代理,则可以:
$response = wp_remote_get($url, [
"user-agent" => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0",
]);