Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9980

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Fetch an OAuth protected resource</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="oauth.enablesslchecks.html">OAuth::enableSSLChecks</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="oauth.generatesignature.html">OAuth::generateSignature</a></div>
 <div class="up"><a href="class.oauth.html">OAuth</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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">Fetch an OAuth protected resource</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-oauth.fetch-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>OAuth::fetch</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$protected_resource_url</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$extra_parameters</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$http_method</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$http_headers</code></span>
  ]]] )</div>

  <p class="para rdfs-comment">
   Fetch a resource.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-oauth.fetch-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">protected_resource_url</code></em></span>
     <dd>

      <p class="para">
       URL to the OAuth protected resource.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">extra_parameters</code></em></span>
     <dd>

      <p class="para">
       Extra parameters to send with the request for the resource.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">http_method</code></em></span>
     <dd>

      <p class="para">
       One of the <strong><code>OAUTH_HTTP_METHOD_*</code></strong>
       <a href="oauth.constants.html" class="link">OAUTH constants</a>, which includes
       GET, POST, PUT, HEAD, or DELETE.
      </p>
      <p class="para">
       HEAD (<strong><code>OAUTH_HTTP_METHOD_HEAD</code></strong>) can be useful for
       discovering information prior to the request (if OAuth credentials are
       in the <em>Authorization</em> header).
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">http_headers</code></em></span>
     <dd>

      <p class="para">
       HTTP client headers (such as User-Agent, Accept, etc.)
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-oauth.fetch-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-oauth.fetch-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>1.0.0</td>
       <td>
        Previously returned <strong><code>NULL</code></strong> on failure, instead of <strong><code>FALSE</code></strong>.
       </td>
      </tr>

      <tr>
       <td>0.99.5</td>
       <td>
        The <em><code class="parameter">http_method</code></em> parameter was added
       </td>
      </tr>

      <tr>
       <td>0.99.8</td>
       <td>
        The <em><code class="parameter">http_headers</code></em> parameter was added
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-oauth.fetch-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-5283">
    <p><strong>Example #1  <span class="function"><strong>OAuth::fetch()</strong></span> example</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&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$oauth&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">OAuth</span><span style="color: #007700">(</span><span style="color: #DD0000">"consumer_key"</span><span style="color: #007700">,</span><span style="color: #DD0000">"consumer_secret"</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 />&nbsp;&nbsp;&nbsp;&nbsp;</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">"access_token"</span><span style="color: #007700">,</span><span style="color: #DD0000">"access_token_secret"</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$response_info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLastResponseInfo</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-Type:&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$oauth</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLastResponse</span><span style="color: #007700">();<br />}&nbsp;catch(</span><span style="color: #0000BB">OAuthException&nbsp;$E</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Exception&nbsp;caught!\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Response:&nbsp;"</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$E</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">lastResponse&nbsp;</span><span style="color: #007700">.&nbsp;</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>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-oauth.fetch-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="methodname"><a href="oauth.getlastresponse.html" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponse()</a> - Get the last response</span></li>
    <li class="member"> <span class="methodname"><a href="oauth.getlastresponseinfo.html" class="methodname" rel="rdfs-seeAlso">OAuth::getLastResponseInfo()</a> - Get HTTP information about the last response</span></li>
    <li class="member"> <span class="methodname"><a href="oauth.settoken.html" class="methodname" rel="rdfs-seeAlso">OAuth::setToken()</a> - Sets the token and secret</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="oauth.enablesslchecks.html">OAuth::enableSSLChecks</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="oauth.generatesignature.html">OAuth::generateSignature</a></div>
 <div class="up"><a href="class.oauth.html">OAuth</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>