package.xml 0000644 0000765 0000024 00000054355 14701164664 012030 0 ustar mike staff
oauthpecl.php.netoauth consumer extensionOAuth is an authorization protocol built on top of HTTP which allows applications to securely access data without having to store usernames and passwords.
Requirements: ext/hash (now a part of PHP core)John Jawedjawedjawed@php.netyesRasmus Lerdorfrasmusrasmus@php.netyesSean DuBoisSeanDerSeanDer@php.netyesMichael Wallnermikemike@php.netyesFelipe Penafelipefelipe@php.netyesTjerk Meestersdatibbawdatibbaw@php.netyes2024-10-082.0.92.0stablestableBSD
* Fix PHP-8.3 deprecations
* Fix PHP-8.4 compatibility
7.0.01.4.0b1hashoauth2022-04-212.0.82.0stablestableBSD
* Fix sporadic segfault in checkOAuthRequest
2022-04-212.0.82.0stablestableBSD
* Fix sporadic segfault in checkOAuthRequest
2020-09-182.0.72.0stablestableBSD
* PHP 8 compatibility
2020-09-092.0.62.0stablestableBSD
* Fix github issue #14 (Fixes for 7.3/7.4 and opcache)
* Fix PHP-7.4 compatibility of object handler
* Fix memory leaks in OAuthProvider
* Fix crash in OAuthProvider's handler registration methods due to unconditional addref
* Fix crash in OAuth::fetch() due to modifying hash tables with a refcount>1
2020-02-062.0.52.0stablestableBSD
* fix config.w32 (cmb)
* fix 7.3 segfault (rlerdorf)
* replace uint-uint32_t, ulong-zend_ulong (Jan-E)
* handle cases where a passed in array might be a const (keyurdg)
* Fix configure for recent cURL versions (cmb)
* Bug #76722 cURL library headers not recognized on Debian 9 (js361014)
2019-12-022.0.42.0stablestableBSD
* fix php_pcre_match_impl call in 7.4+ (Remi)
2018-09-302.0.32.0stablestableBSD
* Use _ex versions to avoid SIGABRT of during use of hash functions in 7.2+ (Derick Rethans)
2018-06-282.0.22.0stablestableBSD
* Fix bug #74163: Segfault in oauth_compare_value
* Fix bug #73434: Null byte at end of array keys in getLastResponseInfo
* Fix compatibility with PHP 7.3
2016-06-172.0.22.0-devstablestableBSD
* Fix #72006
2016-03-112.0.12.0stablestableBSD
* Fix multiple segfaults (kgovande, rlerdorf)
2016-01-022.0.02.0stablestableBSD
- PHP 7 Support
- Bug 67658: configure does not detect missing pcre.h
- Bug 67665: update fetch to accept 20X HTTP ranges
- Bug 67883: check SERVER[REDIRECT_HTTP_AUTHORIZATION] for the Authorization header
2012-10-011.2.31.2stablestableBSD
- Fix reference counts not being incremented in OAuthProvider
2011-07-221.2.21.2stablestableBSD
- Bug 22834
2011-07-191.2.11.2stablestableBSD
- Fixed bugs: 22819, 22824
2011-06-271.21.2stablestable
- Fixed bugs: 22337, 22485, 22628, 22630, 22484 (and others!)
- Added ability to coerce HTTP method when calling OAuth::fetch()
2011-02-061.1.01.1.0stablestable
- Fixed bugs: 17782, 18214, 21426, 22093
- Added PLAINTEXT signature method support (stas@)
- Added OAuth::getRequestHeader and OAuth::setSSLChecks (hirokawa@)
2011-06-021.0.01.0.0stablestable
- Added php streams support (libcurl is no longer required)
- Added OAuthProvider support (http://php.net/oauthprovider)
- Added RSA-SHA1 signature support
- Added SHA256 signature support
- Added OAuth::setTimeout, OAuth::generateSignature, OAuth::setRequestEngine
- Send the User-Agent header for pecl/oauth
- Lots of other improvements...
2009-05-090.99.90.99.9betabeta
- Added 1.0a support (based on implementer Draft 2, http://oauth.googlecode.com/svn/spec/core/1.0a/drafts/2/oauth-core-1_0a.html)
- Added support for empty parameters
- Added oauth_callback support to getRequestToken
- Added oauth_verifier support to getAccessToken
- Fixed build failures for PHP5.1
2010-06-021.0.01.0.0stablestable
- Added php streams support (libcurl is no longer required)
- Added OAuthProvider support (http://php.net/oauthprovider)
- Added RSA-SHA1 signature support
- Added SHA256 signature support
- Added OAuth::setTimeout, OAuth::generateSignature, OAuth::setRequestEngine
- Send the User-Agent header for pecl/oauth
- Lots of other improvements...
2009-05-090.99.90.99.9betabeta
- Added 1.0a support (based on implementer Draft 2, http://oauth.googlecode.com/svn/spec/core/1.0a/drafts/2/oauth-core-1_0a.html)
- Added support for empty parameters
- Added oauth_callback support to getRequestToken
- Added oauth_verifier support to getAccessToken
- Fixed build failures for PHP5.1
2009-04-300.99.80.99.8betabeta
- Throw an exception if a caller attempts to use something other than HTTP POST with an auth type set to FORM
- Do not use pear package version number (bug #16404)
- Please read http://oauth.net/advisories/2009-1
2009-04-230.99.70.99.7betabeta
- Throw an exception if a caller attempts to use something other than HTTP POST with an auth type set to FORM
- Do not use pear package version number (bug #16404)
- Please read http://oauth.net/advisories/2009-1
2009-04-200.99.60.99.6betabeta
- Win32 support (pierre)
- Fixed bug #16398
- Use pear package version number
2009-04-200.99.50.99.5betabeta
- Added support for multiple protocols (Tjerk Meesters)
- Signature generation fix for quoted values
- Added disableSSLChecks and enableSSLChecks (enabled by default)
- Added support for following and signing redirects
2009-03-260.99.50.99.5betabetaBSD
- Added extra constants for Google Portable Contact API's
2008-26-030.99.30.99betabetaBSD
- Fixed double free with Zend object (Rasmus)
- Fixed memory leaks if ext/hash was not available
- Encode consumer secret first for the properties hash
- Added enableDebug and disableDebug functions (docs coming soon)
- More examples (Twitter, Google Portable Contacts, Netflix)
2008-12-030.99.20.99betabetaBSD
- Fixed PECL bug #15110 #15111 (ZTS build, Segfault and memory leak, hannes/felipe) + other memleaks
- Fixed PECL bug #15112 (incorrect cvs branch)
- Updated fetch to respect additional request params, added examples and TODO
- Updates for 5.3
- Support for older libcurl versions
- Added arginfo
- Marking as beta
2008-11-200.99.10.99alphaalphaBSD
- Initial release.
oauth-2.0.9/examples/config.inc.php 0000644 0000765 0000024 00000000473 14701164664 016033 0 ustar mike staff
oauth-2.0.9/examples/request_signing.php 0000644 0000765 0000024 00000001507 14701164664 017223 0 ustar mike staff setToken(GENERAL_PURPOSE_TOKEN,GENERAL_PURPOSE_TOKEN_SECRET);
$o->fetch("https://www.some.tld/1.0/an_api");
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(Exception $E) {
echo "Error: [".$E->errorMessage."] \n";
echo "Response: [".$E->lastResponse."] \n";
exit;
}
oauth-2.0.9/examples/request_token.php 0000644 0000765 0000024 00000001136 14701164664 016703 0 ustar mike staff getRequestToken("https://www.foo.tld/oauth/requestToken");
file_put_contents(OAUTH_TMP_DIR ."/request_token_resp",serialize($arrayResp));
/* note: on the redirect there is no need to pass anything other than the oauth_token parameter */
header("Location: https://www.foo.tld/oauth/authorize?oauth_token={$arrayResp["oauth_token"]}");
} catch(OAuthException $E) {
print_r($E);
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/access_token.php 0000644 0000765 0000024 00000001174 14701164664 016456 0 ustar mike staff setToken($request_token_info["oauth_token"],$request_token_info["oauth_token_secret"]);
$arrayResp = $o->getAccessToken("https://www.foo.tld/oauth/accessToken");
file_put_contents(OAUTH_TMP_DIR . "/access_token_resp",serialize($arrayResp));
echo "Finished getting the access token!";
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/exec_api.php 0000644 0000765 0000024 00000001040 14701164664 015562 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$arrayResp = $o->fetch("https://www.foo.tld/oauth/an_api_for_user_info",array("extra" => "arg(h)"));
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/README 0000644 0000765 0000024 00000001507 14701164664 014164 0 ustar mike staff === CONFIGURATION ===
2 things need updated with information from the OAuth service provider:
* config.inc.php
* the URL's of the providers resources (to get tokens, manipulate user info, etc.)
=== RUNNING EXAMPLES ===
To run the examples:
1) Execute request_token.php
2) Direct your web browser to the URL provided and authorize the access
3) Execute access_token.php
After the above steps, the application examples can be run.
There are several directories here which relate to OAuth service providers
and their interfaces. The current directory contains generic examples.
Please contribute to example code for new providers as they come along accordingly.
The example code writes token information to /tmp in a static file, this is not
a good idea for anything beyond tinkering, you should store these tokens
somewhere safer.
oauth-2.0.9/examples/yahoo/config.inc.php 0000644 0000765 0000024 00000000663 14701164664 017153 0 ustar mike staff
oauth-2.0.9/examples/yahoo/request_signing.php 0000644 0000765 0000024 00000001270 14701164664 020337 0 ustar mike staff fetch("http://query.yahooapis.com/v1/yql?q=show%20tables&format=xml");
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(Exception $E) {
echo "Error: [".$E->getMessage()."] \n";
echo "Response: [".$E->lastResponse."] \n";
exit;
}
oauth-2.0.9/examples/yahoo/request_token.php 0000644 0000765 0000024 00000001107 14701164664 020020 0 ustar mike staff getRequestToken("https://api.login.yahoo.com/oauth/v2/get_request_token");
file_put_contents(OAUTH_TMP_DIR . "/request_token_resp",serialize($arrayResp));
$authorizeUrl = $arrayResp["xoauth_request_auth_url"];
if(PHP_SAPI=="cli") {
echo "Navigate your http client to: {$authorizeUrl}\n";
} else {
header("Location: {$authorizeUrl}");
}
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/yahoo/access_token.php 0000644 0000765 0000024 00000001151 14701164664 017570 0 ustar mike staff setToken($request_token_info["oauth_token"],$request_token_info["oauth_token_secret"]);
$arrayResp = $o->getAccessToken("https://api.login.yahoo.com/oauth/v2/get_token");
file_put_contents(OAUTH_TMP_DIR . "/access_token_resp",serialize($arrayResp));
echo "Finished getting the access token!\n";
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/yahoo/exec_yql.php 0000644 0000765 0000024 00000001314 14701164664 016741 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$query = rawurlencode("select * from social.profile where guid=me");
$o->fetch("http://query.yahooapis.com/v1/yql?q=$query&format=xml");
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/yahoo/exec_yql_refresh_token.php 0000644 0000765 0000024 00000002755 14701164664 021671 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
/* the following bit refreshes the token using the session handle (http://wiki.oauth.net/ScalableOAuth) ... you don't need it unless your original access token is invalid but you'll need to audit this yourself, for example sakes we'll pretend it has expired. */
if(!empty($access_token_info["oauth_session_handle"])) {
$o->setAuthType(OAUTH_AUTH_TYPE_URI);
$access_token_info = $o->getAccessToken("https://api.login.yahoo.com/oauth/v2/get_token",$access_token_info["oauth_session_handle"]);
$o->setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$o->setAuthType(OAUTH_AUTH_TYPE_AUTHORIZATION);
file_put_contents(OAUTH_TMP_DIR . "/access_token_resp",serialize($access_token_info));
}
/* done refreshing access token, time to do some fetching! */
$query = rawurlencode("select * from social.profile where guid=me");
$o->fetch("http://query.yahooapis.com/v1/yql?q=$query&format=xml");
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/fireeagle/config.inc.php 0000644 0000765 0000024 00000000723 14701164664 017754 0 ustar mike staff
oauth-2.0.9/examples/fireeagle/request_signing.php 0000644 0000765 0000024 00000001536 14701164664 021150 0 ustar mike staff setToken(GENERAL_PURPOSE_TOKEN,GENERAL_PURPOSE_TOKEN_SECRET);
$o->fetch("https://fireeagle.yahooapis.com/api/0.1/recent.xml");
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(Exception $E) {
echo "Error: [".$E->errorMessage."] \n";
echo "Response: [".$E->lastResponse."] \n";
exit;
}
oauth-2.0.9/examples/fireeagle/request_token.php 0000644 0000765 0000024 00000001333 14701164664 020625 0 ustar mike staff getRequestToken("https://fireeagle.yahooapis.com/oauth/request_token");
file_put_contents(OAUTH_TMP_DIR . "/request_token_resp",serialize($arrayResp));
$authorizeUrl = "https://fireeagle.yahoo.net/oauth/authorize?oauth_token={$arrayResp["oauth_token"]}";
if(PHP_SAPI=="cli") {
echo "Navigate your http client to: {$authorizeUrl}\n";
} else {
/* note: on the redirect there is no need to pass anything other than the oauth_token parameter */
header("Location: {$authorizeUrl}");
}
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/fireeagle/access_token.php 0000644 0000765 0000024 00000001176 14701164664 020403 0 ustar mike staff setToken($request_token_info["oauth_token"],$request_token_info["oauth_token_secret"]);
$arrayResp = $o->getAccessToken("https://fireeagle.yahooapis.com/oauth/access_token");
file_put_contents(OAUTH_TMP_DIR . "/access_token_resp",serialize($arrayResp));
echo "Finished getting the access token!\n";
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/fireeagle/exec_update_user.php 0000644 0000765 0000024 00000001150 14701164664 021256 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
/* https://fireeagle.yahoo.net/developer/documentation/updating */
$arrayResp = $o->fetch("https://fireeagle.yahooapis.com/api/0.1/update",array("postal" => "95054"));
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/netflix/config.inc.php 0000644 0000765 0000024 00000000544 14701164664 017503 0 ustar mike staff
oauth-2.0.9/examples/netflix/request_token.php 0000644 0000765 0000024 00000001223 14701164664 020351 0 ustar mike staff getRequestToken("http://api.netflix.com/oauth/request_token");
file_put_contents(OAUTH_TMP_DIR . "/request_token_resp",serialize($arrayResp));
$authorizeUrl = $arrayResp["login_url"] . "&oauth_consumer_key=" . OAUTH_CONSUMER_KEY . "&application_name=" . $arrayResp["application_name"];
if(PHP_SAPI=="cli") {
echo "Navigate your http client to: {$authorizeUrl}\n";
} else {
header("Location: {$authorizeUrl}");
}
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/netflix/access_token.php 0000644 0000765 0000024 00000001144 14701164664 020124 0 ustar mike staff setToken($request_token_info["oauth_token"],$request_token_info["oauth_token_secret"]);
$arrayResp = $o->getAccessToken("http://api.netflix.com/oauth/access_token");
file_put_contents(OAUTH_TMP_DIR . "/access_token_resp",serialize($arrayResp));
echo "Finished getting the access token!\n";
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
oauth-2.0.9/examples/netflix/feeds.php 0000644 0000765 0000024 00000001324 14701164664 016551 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$feeds_url = "http://api.netflix.com/users/". oauth_urlencode($access_token_info["user_id"]) ."/feeds";
$o->fetch($feeds_url);
$response_info = $o->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $o->getLastResponse();
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
var_dump($E);
}
oauth-2.0.9/examples/netflix/rental_history_atom.php 0000644 0000765 0000024 00000002233 14701164664 021551 0 ustar mike staff setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$feeds_url = "http://api.netflix.com/users/". oauth_urlencode($access_token_info["user_id"]) ."/feeds";
$o->fetch($feeds_url);
$feeds = $o->getLastResponse();
/* we need to pick the rental history feed (returned rentals) */
$feeds_xml = new SimpleXMLElement($feeds);
/* if you want to access other feeds, change the following rel attribute */
$feed_rel = "http://schemas.netflix.com/feed.rental_history.returned";
$returned_feed = current($feeds_xml->xpath("/resource/link[@rel=\"{$feed_rel}\"]"))->attributes();
/* don't sign the feed requests */
$curl = curl_init($returned_feed["href"]);
curl_exec($curl);
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
var_dump($E);
}
oauth-2.0.9/examples/twitter/README 0000644 0000765 0000024 00000000070 14701164664 015660 0 ustar mike staff Run fetchTimeline.php through with your php-cli binary.
oauth-2.0.9/examples/twitter/constants.php 0000644 0000765 0000024 00000001601 14701164664 017526 0 ustar mike staff
oauth-2.0.9/examples/twitter/fetchTimeline.php 0000644 0000765 0000024 00000003053 14701164664 020275 0 ustar mike staff enableDebug();
$request_token_info = $oauth->getRequestToken(TWITTER_REQUEST_TOKEN_URL);
printf("I think I got a valid request token, navigate your www client to:\n\n%s?oauth_token=%s\n\nOnce you finish authorizing, hit ENTER or INTERRUPT to exit\n\n", TWITTER_AUTHORIZE_URL, $request_token_info["oauth_token"]);
$in = fopen("php://stdin", "r");
fgets($in, 255);
printf("Grabbing an access token...\n");
/* grab the access token, which is your persistent token which you use for future requests */
$oauth->setToken($request_token_info["oauth_token"],$request_token_info["oauth_token_secret"]);
$access_token_info = $oauth->getAccessToken(TWITTER_ACCESS_TOKEN_URL);
printf("Access token: %s\n",$access_token_info["oauth_token"]);
printf("Access token secret: %s\n",$access_token_info["oauth_token_secret"]);
printf("Fetching the public timeline JSON via %s\n",TWITTER_PUBLIC_TIMELINE_API);
$oauth->setToken($access_token_info["oauth_token"],$access_token_info["oauth_token_secret"]);
$oauth->fetch(TWITTER_PUBLIC_TIMELINE_API);
/* from this point on OAuth is over, now handling the JSON response is in order */
$json = json_decode($oauth->getLastResponse());
printf("An item in the decoded JSON: %s\n",print_r($json[0],true));
} catch(OAuthException $E) {
print_r($E);
}
?>
oauth-2.0.9/examples/twitter/php.jpg 0000644 0000765 0000024 00000054712 14701164664 016305 0 ustar mike staff JFIF H H Created with GIMP C
C ,
o
#
!"312CScs$ABRb4QaqrDT%Ut&W')57:VYdeguw < !1"AQ2aq#B$3RS4T ? 0 0 0 0 0y@W,(]'-ĊL턧e%$l|߳GAo|EDZVrmLH\4lbG86*my]`f}R טaĕcaC: 7w= NV*+̵i|ji%ԧn峘;`֡8#JGwR78AA.7\XU_cy]=s3^MTo ƮpnkQc>v3:m/ďOg2 E 8~ю+4cIUbyiЮ {Zq\R}=tukU:;6R=T 0 0 0 0 0 0 02 |w^ 0P0A$?.i zRBQACQjPt`wGH<["4}Keo>Qv|(\v}LI]2C0$s:&AO
Fd<]Mby3xäIk}>zT*BKe%7?m4뇸
v}_֩֟,K^c
(EO:VA /OnebY9|Iil%RQtr%iI5zdm^)Nkr+ &=&$%:VtpbpX
S{zmUH9i<ŹJؽA1P'AL?m_Oeu/GةrΗj]ԣM5.YYCSɞCThꤥdEĕbIPI j+(̺|MN]GHsH[KdF 7m-D)l_+-${ E#$' E*3e Z5/%ΌkV{vpɦqHF6ThS jũ&PjJ(7RGw_VدЀeaGL/RrQ#ۧZƐ};Ŏ7tUɱi λNxVʪ32(7'FFDy&&tL% &_k*S,1?L;x6z_;dH?,)Y:S*J=!diCAʉnWӆr0FCc=(b|o lp7XWʙ¥o
MB+uM$j%А scPNP{䏧bBOүё3Ef'>*aŮ({Tߨ<c 8wsFnkOU۬Z.L#Yl>wMk Kӊ >M NiΑمL5i;v_zrJV04ӥBcƟ~(ZÚR{6Ʀ{!0XU%='4фV4nmN6)4]RN__]Fǯ':*}{?FzҍԪiFGztq{}sѴ~]7$=&96[!-lb".(t4s·i+Zf4}TF4`[5G#bg;]a:c3̰'" fXXN w>0aGN'Xo=Ay4O(dԨB[I&.kVX|3'/\4:m]c )[w9+zZF&dLOPopZg7$#cѓAW^,0:Ai'/0HG)P?cT&V=s[^'oJIe:Za^n},kSJwZ78ɳ܍߂Syt