Skip to content

Instantly share code, notes, and snippets.

View cosenary's full-sized avatar

Christian Metz cosenary

View GitHub Profile
@cosenary
cosenary / instagramproxy.php
Created April 6, 2015 10:07
Instagram OAuth proxy
<?php
// Registered Instagram redirect URI: http://example.com/instagramproxy.php
// Custom YOUR_APP_CALLBACK redirect URI: http://example.com/instagramproxy.php?redirect=http://foo.com
// receive OAuth code parameter
$code = $_GET['code'];
$redirectHost = $_GET['redirect'];
$instagramEndpoint = $redirectHost . "/success.php?code=" . $code;
@cosenary
cosenary / usermedia.php
Last active May 26, 2017 07:17
Load user's public Instagram media
<?php
/**
* Instagram PHP API
* Example for using the getUserMedia() method
*
* @link https://github.com/cosenary/Instagram-PHP-API
* @author Christian Metz
* @since 4.04.2014
*/
@cosenary
cosenary / ratelimit.php
Created November 8, 2014 16:10
Instagram PHP API - Receive ratelimit header
<?php
/**
* Instagram PHP API
*
* @link https://github.com/cosenary/Instagram-PHP-API
* @author Christian Metz
* @since 8.11.2014
*/
@cosenary
cosenary / index.php
Last active June 17, 2019 15:04
Instagram API login (with sessions)
<?php
require '../src/Instagram.php';
use MetzWeb\Instagram\Instagram;
session_start();
if (isset($_SESSION['access_token'])) {
// user authentication -> redirect to media
header('Location: success.php');
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page progress example</title>
<style>
body {
background-color: #fff;
}
#page_progress {
@cosenary
cosenary / follow.php
Last active December 25, 2020 07:13
Instagram API class - follow user example
<?php
require 'Instagram.php';
use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array(
'apiKey' => 'YOUR_APP_KEY',
'apiSecret' => 'YOUR_APP_SECRET',
'apiCallback' => 'YOUR_APP_CALLBACK' // must point to success.php
));
@cosenary
cosenary / follower.json
Last active December 2, 2020 15:28
Instagram display user follower example.Simply replace the success.php file in the example folder by this one and fill in your API credentials.
{
"username": "moo",
"bio": "We print things.",
"website": "http://www.moo.com",
"profile_picture": "http://images.ak.instagram.com/profiles/profile_7927894_75sq_1378988556.jpg",
"full_name": "MOO Print",
"id": 7927894
}
@cosenary
cosenary / Benchmark.java
Last active December 19, 2015 08:59
Simple Benchmark chart class in Java.
/**
* Benchmark chart.
* Fancy benchmark chart generator.
*
* @since 4.04.2013
* @author Christian Metz | christian@metzweb.net
* @version 1.0
*/
class Benchmark {
@cosenary
cosenary / index.php
Last active June 14, 2019 19:49
Instagram PHP API - Likes
<?php
require 'Instagram.php';
use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array(
'apiKey' => 'YOUR_APP_KEY',
'apiSecret' => 'YOUR_APP_SECRET',
'apiCallback' => 'YOUR_APP_CALLBACK'
));
@cosenary
cosenary / ajax-script.js
Created June 22, 2012 23:36
Suggestion to improve `load-more button` for TDunham02
// Relace the jQuery AJAX snippet by this:
$.ajax({
type: 'GET',
url: 'ajax.php',
data: {
tag: tag,
max_id: maxid
},
dataType: 'json',