本文整理汇总了PHP中Instagram::pagination方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::pagination方法的具体用法?PHP Instagram::pagination怎么用?PHP Instagram::pagination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::pagination方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instagram
public function instagram()
{
$id = '1600192808';
set_time_limit(0);
ini_set('memory_limit', '-1');
ini_set('max_execution_time', '999999');
require APPPATH . 'third_party/Instagram/Instagram.php';
require APPPATH . 'third_party/Instagram/InstagramException.php';
$config = '2440e15f188a41439c6edcd698ff081f';
$instagram = new Instagram($config);
$response = $instagram->getUserMedia($id);
while ($response && count($response->data)) {
if ($response->meta->code != 200) {
print_r($response);
exit;
}
$items = $response->data;
foreach ($items as $item) {
if (!isset($item->images->standard_resolution->url)) {
continue;
}
$link = $item->link;
$sql = "select * from instagram where link = '{$link}'";
$row = $this->db->query($sql)->row();
if ($row) {
die('FINISH');
}
$file = str_replace(array('https://instagram.com/p/', '/'), '', $link) . '.jpg';
$folder = 'instagram/';
$url = $item->images->low_resolution->url;
copy($url, FCPATH . 'files/' . $folder . $file);
$this->db->insert('nz_file', array('id_folder' => 28, 'id_type' => 1, 'file' => $folder . $file, 'name' => $file, 'alt' => '', 'id_user' => 1, 'deleted' => 0, 'date' => date('Y-m-d H:i:s')));
$idf = $this->db->insert_id();
$this->db->insert('instagram', array('id_file' => $idf, 'link' => $link));
}
$response = $instagram->pagination($response);
}
}
示例2: smamo_instagram
function smamo_instagram()
{
// Klargør svar
$response = array();
$num = isset($_POST['num']) ? 4 * wp_strip_all_tags($_POST['num']) : 4;
// vi skal bruge et hashtag, ellers die();
if (!isset($_POST['hash'])) {
$response['code'] = '400';
$response['error'] = 'No hashtag received';
wp_die(json_encode($response));
}
// Indstil $tag
$tag = wp_strip_all_tags($_POST['hash']);
// Inkluder instagram class
require get_template_directory() . '/functions/instagram/instagram.class.php';
// Opret ny instance
$instagram = new Instagram(array('apiKey' => 'dd36cc7a7be445c8a00d9f383e49f8c8', 'apiSecret' => 'e750735ffba74f8a8ed753a33c7351da', 'apiCallback' => 'http://faaborg-gym.dk'));
$response['images'] = array();
$inst_obj = $instagram->getTagMedia($tag, $num);
$next_page = $instagram->pagination($inst_obj);
$response['next'] = $next_page;
foreach ($inst_obj->data as $key => $val) {
$response['images'][] = $val;
}
wp_die(json_encode($response));
}