Reputation: 445
I've been struggling with this for a while now and still could not find a clear guide to do this.
If I want to make requests to Instagram API using cURL, I do it like this:
<?php
$url = "https://api.instagram.com/v1/users/self/?access_token=MY_TOKEN";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
curl_close($ch);
?>
It works fine, but it's a bit insecure and thats why I'd like to do it with signed request, which uses this sig-parameter.
Now, I can easily create that sig-parameter(signature key) using the code found from here, but how to use that signature with PHP?
I'm totally confused.
Upvotes: 0
Views: 965
Reputation: 1366
The answer is hinted at Instagram's documentation page. Still this is how I did:
$sig
.Attach it to your endpoint using http_build_query() like this:
$endpoint = "https://api.instagram.com/v1/users/self/";
$secured_get_fields = array(
"access_token" => $access_token,
//other get fields as required
"sig" => $sig
);
$api_url = $endpoint . "?" . http_build_query($secured_get_fields);
$api_url
Hope it helps!
Upvotes: 1