Domanda

Guardando http://instagram.com/developer/authentication/ - il modo consigliato diLa comunicazione è Serrside.

Capisco come faccio il passo 1 e il passaggio2.Ma in STEP3 Vogliono che i dati postano direttamente Serverside?(Capisco come potrei fare una richiesta post da jquery) ma è persino possibile fare direttamente da PHP / CodeInter?

Questo è fondamentalmente STEP3:

.

Nel passaggio precedente, avrai ricevuto un codice che avrai scambiare per ricevere un accesso_token per l'utente.In ordine Per fare questo scambio, devi semplicemente pubblicare questo codice, insieme a Alcuni parametri di identificazione dell'app al nostro endpoint Access_Token.

Ho tutte queste informazioni: (dalla risposta da Instagram)

client_id: your client id
client_secret: your client secret
grant_type: authorization_code is currently the only supported value
redirect_uri: the redirect_uri you used in the authorization request. Note: this has to be the same value as in the authorization request.
code: the exact code you received during the authorization step.
.

È stato utile?

Soluzione

Un back-end può fare un post proprio come il browser.Gran parte di Internet è la comunicazione del server-to-server in questo modo.

Ecco un esempio di richiesta di post in PHP (usando il ricciolo)

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://www.example.com/site.html");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2");

// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec ($ch);

curl_close ($ch);
.

Un modo alternativo per impostare i parametri post anziché creare manualmente la stringa del parametro:

curl_setopt($ch, CURLOPT_POSTFIELDS, 
         http_build_query(array('postvar1' => 'value1')));
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top