I have an InstaGram app and I want to be able to set a custom hashtag in the input field, how could I go about doing this?
Here's how the site works step by step
The user goes here and by default the hashtag will be = "#starcraft2" http://cinicraft.com/InstaCraft/example.php
but when the user clicks InstaCraft, that will then take them to -> example.php then redirect to -> callback.php
So here's the code for the input to set your custom hashtag in callback.php:
<form action="example.php" method="get">
<li>Custom Hashtag:<p> <input type="text" name="hashGET" size="45"> </p></li>
<input type="submit"></form>
</form>
user clicks submit and Custom Hashtag will be GET'ed to example.php
As soon as example.php opens, I successfully retain the custom hashtag like so:
$hashGET = $_GET["hashGET"]; // <- INSIDE EXAMPLE.PHP
And here is where my problem arises, example.php will then automatically redirect to callback.php. callback.php is what actually sends the custom hashtag to InstaGram and that's where the images come from.
But how can I get example.php -> to send $hashGET to -> callback.php? This is what I have to work with:
$name = $_GET["hashGET"];
session_start();
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
header('Location: callback.php');
die();
}
// Instantiate the API handler object
$instagram = new Instagram($config);
$instagram->openAuthorizationUrl();
Why do you redirect? Simply put your code into a function and call that.
This also saves you one server-browser roundtrip.