<?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 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'oauth.fetch.php',
    1 => 'OAuth::fetch',
    2 => 'Busca um recurso protegido OAuth',
  ),
  'up' => 
  array (
    0 => 'class.oauth.php',
    1 => 'OAuth',
  ),
  'prev' => 
  array (
    0 => 'oauth.enablesslchecks.php',
    1 => 'OAuth::enableSSLChecks',
  ),
  'next' => 
  array (
    0 => 'oauth.generatesignature.php',
    1 => 'OAuth::generateSignature',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/oauth/oauth/fetch.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="oauth.fetch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">OAuth::fetch</h1>
  <p class="verinfo">(PECL OAuth &gt;= 0.99.1)</p><p class="refpurpose"><span class="refname">OAuth::fetch</span> &mdash; <span class="dc-title">Busca um recurso protegido OAuth</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauth.fetch-description">
  <h3 class="title">Descrição</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>OAuth::fetch</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">$protected_resource_url</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$extra_parameters</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>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$http_headers</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="simpara">
   Busca um recurso.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-oauth.fetch-parameters">
  <h3 class="title">Parâmetros</h3>
  <dl>
   
    <dt><code class="parameter">protected_resource_url</code></dt>
    <dd>
     <span class="simpara">
      URL para o recurso protegido OAuth.
     </span>
    </dd>
   
   
    <dt><code class="parameter">extra_parameters</code></dt>
    <dd>
     <span class="simpara">
      Parâmetros extra a enviar com a requisição para o recurso.
     </span>
    </dd>
   
   
    <dt><code class="parameter">http_method</code></dt>
    <dd>
     <span class="simpara">
      Uma das constantes <strong><code><a href="oauth.constants.php#constant.oauth-http-method-get">OAUTH_HTTP_METHOD_<span class="replaceable">*</span></a></code></strong>,
      que incluem
      GET, POST, PUT, HEAD, ou DELETE.
     </span>
     <span class="simpara">
      HEAD (<strong><code><a href="oauth.constants.php#constant.oauth-http-method-head">OAUTH_HTTP_METHOD_HEAD</a></code></strong>) pode ser útil para
      descobrir informações antes da requisição (se as credenciais OAuth estiverem
      no cabeçalho <code class="literal">Authorization</code>).
     </span>
    </dd>
   
   
    <dt><code class="parameter">http_headers</code></dt>
    <dd>
     <span class="simpara">
      Cabeçalhos de cliente HTTP (tais como User-Agent, Accept, etc.)
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-oauth.fetch-returnvalues">
  <h3 class="title">Valor Retornado</h3>
  <p class="simpara">
   Retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> em caso de sucesso ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> em caso de falha.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-oauth.fetch-changelog">
  <h3 class="title">Registro de Alterações</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versão</th>
      <th>Descrição</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL oauth 1.0.0</td>
      <td>
       Anteriormente, retornava <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> em caso de falha, em vez de <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </td>
     </tr>

     <tr>
      <td>PECL oauth 0.99.5</td>
      <td>
       O parâmetro <code class="parameter">http_method</code> foi adicionado.
      </td>
     </tr>

     <tr>
      <td>PECL oauth 0.99.8</td>
      <td>
       O parâmetro <code class="parameter">http_headers</code> foi adicionado.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-oauth.fetch-examples">
  <h3 class="title">Exemplos</h3>
  <div class="example" id="example-1">
   <p><strong>Exemplo #1 Exemplo de <span class="function"><strong>OAuth::fetch()</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: #DD0000">"chave_consumidor"</span><span style="color: #007700">,</span><span style="color: #DD0000">"senha_consumidor"</span><span style="color: #007700">,</span><span style="color: #0000BB">OAUTH_SIG_METHOD_HMACSHA1</span><span style="color: #007700">,</span><span style="color: #0000BB">OAUTH_AUTH_TYPE_AUTHORIZATION</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: #DD0000">"token_acesso"</span><span style="color: #007700">,</span><span style="color: #DD0000">"senha_token_acesso"</span><span style="color: #007700">);<br /><br />    </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://photos.example.net/photo?file=vacation.jpg"</span><span style="color: #007700">);<br /><br />    </span><span style="color: #0000BB">$response_info </span><span style="color: #007700">= </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLastResponseInfo</span><span style="color: #007700">();<br />    </span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-Type: </span><span style="color: #007700">{</span><span style="color: #0000BB">$response_info</span><span style="color: #007700">[</span><span style="color: #DD0000">"content_type"</span><span style="color: #007700">]}</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />    echo </span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLastResponse</span><span style="color: #007700">();<br />} catch(</span><span style="color: #0000BB">OAuthException $E</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Exceção capturada!\n"</span><span style="color: #007700">;<br />    echo </span><span style="color: #DD0000">"Resposta: "</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>
 </div>


 <div class="refsect1 seealso" id="refsect1-oauth.fetch-seealso">
  <h3 class="title">Veja Também</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="oauth.getlastresponse.php" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponse()</a> - Obt&eacute;m a &uacute;ltima resposta</span></li>
   <li><span class="methodname"><a href="oauth.getlastresponseinfo.php" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponseInfo()</a> - Obt&eacute;m informa&ccedil;&atilde;o HTTP sobre a &uacute;ltima resposta</span></li>
   <li><span class="methodname"><a href="oauth.settoken.php" class="methodname" rel="rdfs-seeAlso">OAuth::setToken()</a> - Define o token e o segredo</span></li>
  </ul>
 </div>


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