Как получить данные Instagram, используя curl php? - PullRequest
0 голосов
/ 04 октября 2019

Я пытаюсь получить данные из Instagram, используя метод curl, но страница пуста. Я не могу понять, почему я получил пустую страницу: /

function fetchData($url){
    $ch = curl_init();
    curl_setopt_array($ch, array(

         CURLOPT_URL            => $url,
         CURLOPT_RETURNTRANSFER => true,
         CURLOPT_SSL_VERIFYPEER => false,
         CURLOPT_SSL_VERIFYHOST => 2

        ));

          $total_result = curl_exec($ch);
          curl_close($ch);

         return $total_result;

}

function passer($id, $token)
{
   $insta_info = fetchData("https://api.instagram.com/v1/users/".$id."/media/recent/?access_token=".$token." ");

   $new = json_decode($insta_info, true);

  print_r($new);//data to printout

}

 //At this moment client_id, client_secret and other important stuff already define inside the script. 
 //I skip those lines of code which is not necessary.
 passer($data['user']['id'], $data['access_token']); //function calling and providing param
 //ex: $data['user']['id'] is 47xx493
 //ex: $data['access_token'] is random 79ea07xxxx0547a2a4b62263e68e4e8c

Документ API Instagram: https://www.instagram.com/developer/endpoints/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...