アプリ版:「スタンプのみでお礼する」機能のリリースについて

SoundCloud(https://soundcloud.com/)というサイトのデータを取得したいと考えてます。

そこで、まずfile_get_contentsで取得を試みましたが、
実行すると空になり取得できてませんでした
以下ソース
<?php
$a=file_get_contents("https://soundcloud.com/noex4hess9fy/sets/cand-la …
echo $a;
?>

次にcURLでの取得を試みましたが、
拒否?見つからない?みたいな内容が表示されてしまいます

以下ソース
<?php
$url = "https://soundcloud.com/noex4hess9fy/sets/cand-la …
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
var_dump($res);
curl_close($conn);
?>

どうしたらhttps://soundcloud.com/noex4hess9fy/sets/cand-landの内容をそのまま取得できるのでしょうか?
詳しい方教えていただけませんでしょうか?

A 回答 (2件)

URLに自動リンク張られてコードが崩れたので書き直し…



<?php
$url="対象URL";
print file_get_contents($url, false, stream_context_create(["http"=>["ignore_errors"=>true]]));
    • good
    • 0
この回答へのお礼

うーん・・・

実行しましたが取得できませんでした
Oh no!という画面が出てしまいます

お礼日時:2018/10/28 16:50

<?php


print file_get_contents("https://soundcloud.com/noex4hess9fy/sets/cand-la … false, stream_context_create(["http"=>["ignore_errors"=>true]]));
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!