2012-08-22 1 views
0

Je veux envoyer l'en-tête suivant à l'aide boucle:PHP exécuter OAuth boucle

curl -H 'Authorization: OAuth oauth_signature_method="PLAINTEXT",⤦ 
⤥oauth_consumer_key="xxx",oauth_token="xxx",oauth_signature="xxx"' ⤦ 
⤥'https://external.ningapis.com/xn/rest/apiexample/1.0/Photo/recent⤦ 
⤥?xn_pretty=true&fields=image.url,title&count=2' 

commande ci-dessus est pour l'utilisation de la ligne de commande. Quelqu'un sait comment l'exécuter en utilisant curl PHP?

+0

http://whathaveyoutried.com/ – undone

+0

Ce sont vos vraies clés, je me demande ...) – raina77ow

Répondre

3

La ligne -H depuis la ligne de commande curl est CURLOPT_HTTPHEADER dans PHP curl curl_setopt.

Cela devrait être l'exemple le plus fondamental pour ce que vous avez besoin:

$auth = 'Authorization: YOUR_KEYS'; 
$url = 'https://external.ningapis.com/xn/rest/apiexample/1.0/Photo/recent?xn_pretty=true&fields=image.url,title&count=2'; 

$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth)); 
curl_exec($ch); 
curl_close($ch);