protected static function OAuthDiscovery::curl in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/OAuthDiscovery.php \OAuthDiscovery::curl()
- 7.2 lib/oauth-php/library/OAuthDiscovery.php \OAuthDiscovery::curl()
- 7.3 lib/oauth-php/library/OAuthDiscovery.php \OAuthDiscovery::curl()
- 7.5 lib/oauth-php/library/OAuthDiscovery.php \OAuthDiscovery::curl()
- 7.6 lib/oauth-php/library/OAuthDiscovery.php \OAuthDiscovery::curl()
* Try to fetch an XRDS file at the given location. Sends an accept header preferring the xrds file. * *
Parameters
string uri: * @return array (head,body), false on an error
1 call to OAuthDiscovery::curl()
- OAuthDiscovery::discoverXRDS in lib/
oauth-php/ library/ OAuthDiscovery.php - * Discover the XRDS file at the uri. This is a bit primitive, you should overrule * this function so that the XRDS file can be cached for later referral. * *
File
- lib/
oauth-php/ library/ OAuthDiscovery.php, line 201
Class
Code
protected static function curl($uri) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Accept: application/xrds+xml, */*;q=0.1',
));
curl_setopt($ch, CURLOPT_USERAGENT, 'anyMeta/OAuth 1.0 - (OAuth Discovery $LastChangedRevision: 45 $)');
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$txt = curl_exec($ch);
curl_close($ch);
// Tell the logger what we requested and what we received back
$data = "GET {$uri}";
LingotekOAuthRequestLogger::setSent($data, "");
LingotekOAuthRequestLogger::setReceived($txt);
return $txt;
}