par
azizss » 08 déc. 2019, 16:47
bonjour,
je revient vers vous j'ai résolu mon problème je partage mon code
Mais là je cherche a utilise cela pour afficher les images Identifié(e).
Merci de vos aide,
Code : Tout sélectionner
<?php
include_once '../config/config.php';
$clientid = "XXXX";
$accessToken = "XXXXXXXXXXXX";
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$result = fetchData("https://api.instagram.com/v1/users/{$clientid}/media/recent/?access_token={$accessToken}");
$result = json_decode($result);
header('Content-Type: application/json');
print_r($result);
?>
<?php foreach ($result->data as $post): ?>
<?php
echo $link = $post->link; echo '<td>'."\r\n";
echo $img = $post->images->standard_resolution->url; echo '<td>'."\r\n";
echo $count = $post->likes->count; echo '<td>'."\r\n";
echo $name = $post->location->name; echo '<td>'."\r\n";
echo $username = XXXXXXXXXXX; echo '<td>'."\r\n";
$sql= "INSERT INTO `instagram` (`id`, `type`, `lien`, `img`, `number`, `name`, `username`, `date`, `time`) VALUES (NULL, '1', '$link', '$img', '$count', '$name', '$username', NOW(), NOW())";
$bdd->exec($sql);
?>
<?php endforeach ?>
bonjour,
je revient vers vous j'ai résolu mon problème je partage mon code
Mais là je cherche a utilise cela pour afficher les images Identifié(e).
Merci de vos aide,
[code]
<?php
include_once '../config/config.php';
$clientid = "XXXX";
$accessToken = "XXXXXXXXXXXX";
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$result = fetchData("https://api.instagram.com/v1/users/{$clientid}/media/recent/?access_token={$accessToken}");
$result = json_decode($result);
header('Content-Type: application/json');
print_r($result);
?>
<?php foreach ($result->data as $post): ?>
<?php
echo $link = $post->link; echo '<td>'."\r\n";
echo $img = $post->images->standard_resolution->url; echo '<td>'."\r\n";
echo $count = $post->likes->count; echo '<td>'."\r\n";
echo $name = $post->location->name; echo '<td>'."\r\n";
echo $username = XXXXXXXXXXX; echo '<td>'."\r\n";
$sql= "INSERT INTO `instagram` (`id`, `type`, `lien`, `img`, `number`, `name`, `username`, `date`, `time`) VALUES (NULL, '1', '$link', '$img', '$count', '$name', '$username', NOW(), NOW())";
$bdd->exec($sql);
?>
<?php endforeach ?>
[/code]