I get a file_get_contents(http://ift.tt/1S0waH8): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
I want to use domdocument laravel 5.1 to get title and content id from a soundcloud url.
It worked fine with a youtube url and a vimeo url but with soundcloud it won't work.
The url I'm using is: http://ift.tt/1S0waH8 just for testing.
This is my code to get the title and content id:
$doc = new \DOMDocument();
$doc->loadHTML(file_get_contents($input_url));
$title = $doc->getElementsByTagName("title")->item(0)->nodeValue;
$tags = get_meta_tags($input_url);
$link_id = $tags['content'];
DB::table('content_add')->insert([
[
'url' => $input_url,
'title' => $title,
'link_id'=> $link_id,
'type' => $type,
'user_id'=> Auth::id(),
'created_at' => Carbon::now(),
],
]);
At the end I just ad it to a database. Also when using urlencode()
I get this error file_get_contents(https%3A%2F%2Fsoundcloud.com%2Fgracedmusic%2Fhello-adele): failed to open stream: No such file or directory
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire