0
YouTubeからコンテンツを取得しようとするとこのエラーが発生します。HTTPリクエストが失敗しました! HTTP/1.0 400 Bad Request from youtube
Warning: file_get_contents(https://www.youtube.com/results?search_query=html begginer): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in C:\xampp\htdocs\sites\mime\beta\default.php on line 5
マイコード:
<?php
$address = $_GET['q'];
$address = 'https://www.youtube.com/results?search_query=' . $address;
$html = file_get_contents($address);
echo $html;
?>
しかし、私は(例:http://127.0.0.1/sites/mime/beta/default.php?q=html
)1ワードのみ使用ユーチューブからコンテンツを取得しようとした場合、完全にスクリプトの仕事を。
どういうところが間違っていますか?
HTTPSで動作するように[方法(ファイル\ _getの\の_contentsを取得する)の可能性のある重複の内側に入れてエンコードする必要がありますので、これは、URLのですか? ](http://stackoverflow.com/questions/1975461/how-to-get-file-get-contents-to-work-with-https) – jmattheis