2012-08-26 1 views
0

J'essaie d'utiliser l'API oAuth Yahoo. J'ai l'URL d'authentification mais mon CURL ne retourne rien. Quelqu'un peut-il signaler ce que je fais mal?Page non retournée - CURL PHP

Je veux l'écran de connexion (en supposant que je ne l'ai pas déjà connecté) ..

$auth_url = 'https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=qj94ktv';   

// create a new cURL resource 
$ch = curl_init(); 

// set URL and other appropriate options 
curl_setopt($ch, CURLOPT_URL,$auth_url); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false)   

// grab URL and pass it to the browser 
curl_exec($ch); 

// close cURL resource, and free up system resources 
curl_close($ch); 

MERCI

+0

est votre code comme ça ou vous avez oublié ' ',' à la fin d'URL? –

+0

Désolé, c'était une erreur de frappe ... mais le code que j'utilise n'a pas d'erreurs de syntaxe ... J'ai mis à jour mon post ... – Fox

Répondre

0

Votre curl_exec($ch); ne passe pas dans le navigateur. Aussi, vous ne suivez pas lieu comme il réoriente et RETURNTRANSFER

Vous devez assigner une variable ou vider simplement:

$auth_url = 'https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=qj94ktv';   
// create a new cURL resource 
$ch = curl_init(); 
// set URL and other appropriate options 
curl_setopt($ch, CURLOPT_URL,$auth_url); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
// grab URL and pass it to the browser 
echo curl_exec($ch); 
// close cURL resource, and free up system resources 
curl_close($ch); 
+0

Ne fonctionne pas ... Je l'ai essayé .... Mais yahoo donne cette page d'erreur si le oauth_token est faux ... – Fox

+0

édité, vous avez oublié quelques paramètres. –

+0

Le lien est correct lorsque vous collez le lien dans votre navigateur, il demande des informations de connexion/autorisations. – Fox