Skip to content

Instantly share code, notes, and snippets.

@VerizonMediaOwner
Created February 26, 2019 16:43
Show Gist options
  • Save VerizonMediaOwner/279a90382d817bed1fc66e4cfe55788b to your computer and use it in GitHub Desktop.
Save VerizonMediaOwner/279a90382d817bed1fc66e4cfe55788b to your computer and use it in GitHub Desktop.
<?php
// Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
$consumer_key = '<INSERT CONSUMER KEY HERE>';
$consumer_secret = '<INSERT CONSUMER SECRET HERE>';
$o = new OAuth( $consumer_key, $consumer_secret,
OAUTH_SIG_METHOD_HMACSHA1,
OAUTH_AUTH_TYPE_URI );
$url = 'https://fantasysports.yahooapis.com/fantasy/v2/game/nfl';
try {
if( $o->fetch( $url ) ) {
print $o->getLastResponse();
print "Successful fetch\n";
} else {
print "Couldn't fetch\n";
}
} catch( OAuthException $e ) {
print 'Error: ' . $e->getMessage() . "\n";
print 'Response: ' . $e->lastResponse . "\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment