<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.oauth.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'oauth.getaccesstoken.php',
    1 => 'OAuth::getAccessToken',
    2 => 'Recupera un token de acceso',
  ),
  'up' => 
  array (
    0 => 'class.oauth.php',
    1 => 'OAuth',
  ),
  'prev' => 
  array (
    0 => 'oauth.generatesignature.php',
    1 => 'OAuth::generateSignature',
  ),
  'next' => 
  array (
    0 => 'oauth.getcapath.php',
    1 => 'OAuth::getCAPath',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/oauth/oauth/getaccesstoken.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="oauth.getaccesstoken" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">OAuth::getAccessToken</h1>
  <p class="verinfo">(PECL OAuth &gt;= 0.99.1)</p><p class="refpurpose"><span class="refname">OAuth::getAccessToken</span> &mdash; <span class="dc-title">Recupera un token de acceso</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauth.getaccesstoken-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>OAuth::getAccessToken</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$access_token_url</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$auth_session_handle</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$verifier_token</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$http_method</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="simpara">
   Lee un token de acceso, un secreto y cualquier información adicional en
   un proveedor de servicios.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-oauth.getaccesstoken-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
    <dt><code class="parameter">access_token_url</code></dt>
    <dd>
     <span class="simpara">
      La URL a utilizar.
     </span>
    </dd>
   
   
    <dt><code class="parameter">auth_session_handle</code></dt>
    <dd>
     <span class="simpara">
      El identificador de sesión. Este parámetro no existe
      en las especificaciones OAuth 1.0, pero puede ser implementado
      por grandes implementaciones. Véase
      <a href="http://oauth.pbwiki.com/ScalableOAuth/" class="link external">&raquo;&nbsp;<code class="literal">ScalableOAuth</code></a>
      para más detalles.
     </span>
    </dd>
   
   
    <dt><code class="parameter">verifier_token</code></dt>
    <dd>
     <span class="simpara">
      Para los proveedores de servicio que soportan 1.0a,
      el parámetro <code class="parameter">verifier_token</code> debe ser
      proporcionado, al intercambiar el token de solicitud para obtener el token
      de acceso. Si <code class="parameter">verifier_token</code> está presente en
      <code class="parameter">$_GET</code> o <code class="parameter">$_POST</code>, es
      automáticamente pasado y el llamante no necesita especificar
      el parámetro <code class="parameter">verifier_token</code> (generalmente, el token
      de acceso es intercambiado vía la URL de devolución <code class="parameter">callback_url</code>).
      Véase <a href="http://oauth.pbwiki.com/ScalableOAuth/" class="link external">&raquo;&nbsp;ScalableOAuth</a>
      para más información.
     </span>
    </dd>
   

    <dt><code class="parameter">http_method</code></dt>
    <dd>
     <span class="simpara">
      Método HTTP a utilizar, por ejemplo
      <code class="literal">GET</code> o <code class="literal">POST</code>.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-oauth.getaccesstoken-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="simpara">
   Devuelve un array que contiene la respuesta OAuth analizada, en caso de éxito,
   y <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> en caso contrario.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-oauth.getaccesstoken-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL oauth 1.0.0</td>
      <td>
       Antes de esta versión, <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> era devuelto en lugar de <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </td>
     </tr>

     <tr>
      <td>PECL oauth 0.99.9</td>
      <td>
       Se añadió el parámetro <code class="parameter">verifier_token</code>
      </td>
     </tr>

    </tbody>
   
  </table>

  </div>


 <div class="refsect1 examples" id="refsect1-oauth.getaccesstoken-examples">
  <h3 class="title">Ejemplos</h3>
  <div class="example" id="example-1">
   <p><strong>Ejemplo #1 Ejemplo con <span class="function"><strong>OAuth::getAccessToken()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try {<br />    </span><span style="color: #0000BB">$oauth </span><span style="color: #007700">= new </span><span style="color: #0000BB">OAuth</span><span style="color: #007700">(</span><span style="color: #0000BB">OAUTH_CONSUMER_KEY</span><span style="color: #007700">,</span><span style="color: #0000BB">OAUTH_CONSUMER_SECRET</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setToken</span><span style="color: #007700">(</span><span style="color: #0000BB">$request_token</span><span style="color: #007700">,</span><span style="color: #0000BB">$request_token_secret</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$access_token_info </span><span style="color: #007700">= </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getAccessToken</span><span style="color: #007700">(</span><span style="color: #DD0000">"https://example.com/oauth/access_token"</span><span style="color: #007700">);<br />    if(!empty(</span><span style="color: #0000BB">$access_token_info</span><span style="color: #007700">)) {<br />        </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$access_token_info</span><span style="color: #007700">);<br />    } else {<br />        print </span><span style="color: #DD0000">"Error al obtener el token de acceso, la respuesta fue: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLastResponse</span><span style="color: #007700">();<br />    }<br />} catch(</span><span style="color: #0000BB">OAuthException $E</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Respuesta: "</span><span style="color: #007700">. </span><span style="color: #0000BB">$E</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">lastResponse </span><span style="color: #007700">. </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Resultado del ejemplo anterior es similar a:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [oauth_token] =&gt; some_token
    [oauth_token_secret] =&gt; some_token_secret
)</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-oauth.getaccesstoken-seealso">
  <h3 class="title">Ver también</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="oauth.getlastresponse.php" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponse()</a> - Obtiene la &uacute;ltima respuesta</span></li>
   <li><span class="methodname"><a href="oauth.getlastresponseinfo.php" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponseInfo()</a> - Obtiene la informaci&oacute;n HTTP sobre la &uacute;ltima respuesta</span></li>
   <li><span class="methodname"><a href="oauth.settoken.php" class="methodname" rel="rdfs-seeAlso">OAuth::setToken()</a> - Establece el token y el secreto</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>