Skip to content

Instantly share code, notes, and snippets.

@ritou
Created September 26, 2009 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ritou/194319 to your computer and use it in GitHub Desktop.
Save ritou/194319 to your computer and use it in GitHub Desktop.
<?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