function getInstaTag($title)
{
    // 공연 이름 받아와서 url 검색! (insta api 사용)
    $tag = urlencode($title);
    $client_id = "996ffe9e18ab4712b0a135fd1e5608e3";
    $url = 'https://api.instagram.com/v1/tags/search?q=' . $tag . '&client_id=' . $client_id;
    // instagram API 이용
    $all_result = processURL($url);
    $arrtag = json_decode($all_result);
    print_r($arrtag);
    // 데이터에서 태그 갯수 뽑아오기
    if ($arrtag->data[0]) {
        $tagCount = $arrtag->data[0]->media_count;
    } else {
        $tagCount = 0;
    }
    // 태그 갯수 반환하기
    return $tagCount;
}
Exemplo n.º 2
0
define('SU_RUN', 0);
include_once 'config.php';
include_once 'constant.php';
include_once 'dbconn.php';
include_once 'function.php';
if ($_POST['action'] == 'new') {
    if (!(getUserFlag() & SU_USER_ADDURL)) {
        ?>
{
    "Code"  : 403,
    "Info"  : "No Permission" 
}
<?php 
        return;
    }
    $url = processURL($_POST['url']);
    if ($url === false) {
        ?>
{
    "Code"  : 403,
    "Info"  : "Illegal URL Schema" 
}
<?php 
        return;
    }
    if (SU_ID_TYPE == 34) {
        $idSpace = SU_ID_34;
    } else {
        if (SU_ID_TYPE == 36) {
            $idSpace = SU_ID_36;
        } else {
Exemplo n.º 3
0
Arquivo: ajax.php Projeto: yikuo/stb2b
<?php 
echo '<script>console.log("run instajax.php 2");</script>';
$tag = 'bearbeer';
// $access_token = "1931710460.1b26bdc.c215f196c7fc491d851ab7d6d762f148";
$access_token = "1931710460.0e3b2da.b9b8e4f7070a43a489be526403229683";
$iniUrl = 'https://api.instagram.com/v1/tags/' . $tag . '/media/recent?access_token=' . $access_token;
if (isset($_POST["url"]) && !empty($_POST["url"])) {
    $url = $_POST["url"];
} else {
    $url = $iniUrl;
    echo ' null ';
}
echo $url . '<br>';
function processURL($url)
{
    $ch = curl_init();
    curl_setopt_array($ch, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 2));
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
$all_result = processURL($url);
$decoded_results = json_decode($all_result, true);
foreach ($decoded_results['data'] as $item) {
    $image_link = $item['images']['thumbnail']['url'];
    // $image_link = $item['images']['standard_resolution']['url'];
    echo '<img src="' . $image_link . '" />';
}
$nxtUrl = $decoded_results['pagination']['next_url'];
$nxtUrl = "'" . $nxtUrl . "'";
echo '<button onClick="GetImg(' . $nxtUrl . ')" >NEXT</button>';
Exemplo n.º 4
0
<?php

function processURL($url)
{
    return preg_replace("/[^A-Za-z0-9 ]/", '', parse_url($url, PHP_URL_PATH));
}
// Check that a desired template is specified
if (!isset($_POST['url'])) {
    exit;
}
$_GET['SUGGESTR_PAGE'] = processURL($_POST['url']) . '/';
// Set desired page /user/
$_GET['AJAX'] = true;
// Tell controller that this is an ajax request for a page
// Generate GET variables from desired URL
$getString = parse_url($_POST['url'], PHP_URL_QUERY);
$getVars = explode('&', $getString);
foreach ($getVars as $varPair) {
    $vars = explode('=', $varPair);
    if (count($vars) == 2) {
        $_GET[$vars[0]] = $vars[1];
    }
}
// Call main site script
require_once '../../suggestr.php';
/*
// Get supporting
require_once('../../config.php');
require_once(BASE.'templating.php');

// Check template is real