Title: Add additional headers to the wp_remote_get () function.
Last modified: June 27, 2021

---

# Add additional headers to the wp_remote_get () function.

 *  Resolved [Younes](https://wordpress.org/support/users/vanbom/)
 * (@vanbom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/)
 * Hi all,
    I tried to retrieve JSON data from a public instagram account using:`
   wp_remote_get()` from the public url: `$url = https://www.instagram.com/USER/?
   __a=1` .
 * But what I don’t understand is the following:
 * If I am connected to my Instagram account from my browser, the `https://www.instagram.
   com/USER/?__a=1` link opens and displays the JSON result.
 * On the same browser, I test my Plugin which calls the same URL `https://www.instagram.
   com/USER/?__a=1` but this time with the `wp_remote_get()` function , the request
   returns the Login page .
 * My questions :
    Do I have to add the Instagram cookie with my request? do I need
   to add specific headers to the function `wp_remote_get()` ?
 * thank you all

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14603929)
 * You should look at the Instagram API documentation to determine what information
   must be sent with your request. I’d guess the URL you listed would require cookies
   since there is nothing in the URL that identifies the user.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14603969)
 * You cannot add cookies from one site to a request from a different site due to
   security restrictions. There will be some sort of API key you can get from your
   IG account for use in remote requests. Besides guidance from IG’s docs on their
   API, there are a few IG plugins in the repository. You could examine their source
   code for further guidance on how to use their API.
 *  Thread Starter [Younes](https://wordpress.org/support/users/vanbom/)
 * (@vanbom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14605377)
 * Hi all ,
    Firstly thank you for reply.
 * [@diondesigns](https://wordpress.org/support/users/diondesigns/)
    The link is
   as is proposed by Instagram. Example : (If I am connect to instagram) no additional
   params. [cristiano ronaldo](https://farah.123.fr/cris-ins.png)
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/)
    Yes I saw a few Plugins,
   but not all of them do what I want.
 *  [Alan Fuller](https://wordpress.org/support/users/alanfuller/)
 * (@alanfuller)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14608003)
 * You probably need to start here [https://developers.facebook.com/docs/instagram-basic-display-api](https://developers.facebook.com/docs/instagram-basic-display-api)
 *  Thread Starter [Younes](https://wordpress.org/support/users/vanbom/)
 * (@vanbom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14608593)
 * Hi [@alanfuller](https://wordpress.org/support/users/alanfuller/) ,
 * Yes I created an APP, but it allows you to read only a user after accepting it.
   
   The mechanism of instagram basic display api is that: we must send an invitation
   to the User, and he must give us his permission.
 * while me, I want to read the public JSON of a famous person as I indicated in
   the link in a previouse response .
 *  [Alan Fuller](https://wordpress.org/support/users/alanfuller/)
 * (@alanfuller)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14625015)
 * As far as I understand, what you have to to is get an authentication token from
   a user and put it in the header – then you can access the ‘public’ json.
 * > UPDATE
   >  The remaining Instagram Legacy API permission (“Basic Permission”) 
   > was disabled on June 29, 2020. As of June 29, third-party apps no longer have
   > access to the Legacy API. To avoid disruption of service to your app and business,
   > developers previously using the Legacy API should instead rely on Instagram
   > Basic Display API and Instagram Graph API. Please request approval for required
   > permissions through the App Review process.
 * [https://www.instagram.com/developer/](https://www.instagram.com/developer/)
    -  This reply was modified 4 years, 11 months ago by [Alan Fuller](https://wordpress.org/support/users/alanfuller/).
 *  Thread Starter [Younes](https://wordpress.org/support/users/vanbom/)
 * (@vanbom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14625810)
 * Hi [@alanfuller](https://wordpress.org/support/users/alanfuller/) ,
 * I managed to log into the Instagram API and get a token. But I failed to read
   the JSON file, I don’t know which headers should I add.
 * as you can see : [token ](https://farah.123.fr/token-ins.png)
 *  Thread Starter [Younes](https://wordpress.org/support/users/vanbom/)
 * (@vanbom)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14639811)
 * i think there is no alternative . i close the ticket

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Add additional headers to the wp_remote_get () function.’ is closed to
new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 8 replies
 * 4 participants
 * Last reply from: [Younes](https://wordpress.org/support/users/vanbom/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/add-additional-headers-to-the-wp_remote_get-function/#post-14639811)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
