0

こんにちは、どなたか API を使用していいねを投稿したり、instagram を削除したりする方法を教えていただけますか? このコードを使用していいねを削除しようとしましたが、ajax 呼び出しから応答がありません。ここで私が間違っていることを教えてもらえますか?これはphpを実行する可能性がありますか?どのように?

xxxxxxxxxxxxxxxxxx_xxxxxxxx ==> Media-Id など: 23424343243243_2343243243

いいねを削除するための Instagram API ドキュメント

<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

<script type="text/javascript">
function deleteLike() {

alert("inside function");

    var url = "https://api.instagram.com/v1/media/xxxxxxxxxxxxxxxxxx_xxxxxxxx/likes?access_token=XXXX";
    $.post(url, {
        "method": "delete",
    }, function(data) 
       {
         var ajaxResponse = data;

          alert("success"+ajaxResponse);

    })
    }

</script>
</head>
  <body onload="deleteLike();">


</html>

編集済み:クロスドメイン php curl:(しかし、これが post メソッドか delete メソッドかをどのように見分けるのですか?"

$url = "https://api.instagram.com/v1/media/xxxxxxxxxxxxxxxxxx_xxxxxxxx/likes?access_token=XXXX";

        $api_response = get_data(''.$url);
        $record = json_decode($api_response); // JSON decode 



/* gets the data from a URL */
function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
4

1 に答える 1