Created
September 26, 2009 17:06
-
-
Save ritou/194319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 0. phpのインクルードパスをごにょごにょするコードを追記 | |
$path_extra = dirname(__FILE__); | |
$path = ini_get('include_path'); | |
$path = $path_extra . PATH_SEPARATOR . $path; | |
ini_set('include_path', $path); | |
// 1.Include OAuth library. | |
require('lib/YahooOAuth.inc'); | |
// 2.Consumer Key & Secret | |
$consumerKey = ''; | |
$consumerSecret = ''; | |
// 3.callback URL | |
$callback = sprintf('http://%s%s',$_SERVER['SERVER_NAME'],$_SERVER['SCRIPT_NAME']); | |
// 4.sessionを取得 | |
$session = YahooSession::requireSession($consumerKey, $consumerSecret, $callback); | |
// APIレスポンスを取得する | |
require('OpenWatchListApi.inc'); | |
$api = new OpenWatchListApi($session); | |
$parameters = array( | |
'page' => 1, | |
); | |
$response = $api->getResponse($parameters); | |
// 結果表示 | |
header('Content-Type: text/html; charset=utf-8'); | |
?> | |
<html> | |
<head> | |
<title>マイオークション・APIサンプルコード</title> | |
</head> | |
<body> | |
<h1>API サンプルレスポンス</h1> | |
<textarea cols="100" rows="30"><?=htmlspecialchars( $response )?></textarea> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment