Last active
October 11, 2015 08:56
-
-
Save AaronRutley/4441cc1bb46342b18071 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ar_ig_get_photos() { | |
// set end point (json) | |
$endpoint = "https://api.instagram.com/v1/users/etc-json"; | |
// Initiate curl | |
$ch = curl_init(); | |
// Set The Response Format to Json | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json')); | |
// Disable SSL verification | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
// Will return the response, if false it print the response | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// Set the url | |
curl_setopt($ch, CURLOPT_URL,$endpoint); | |
// Execute | |
$result=curl_exec($ch); | |
//echo $result; | |
$decoded_result = json_decode($result, true); | |
$photo_feed = $decoded_result['data']; | |
foreach( $photo_feed as $photo_detail ) { | |
// get the ID for each image | |
$ig_id = $photo_detail['id']; | |
// etc | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment