cvs: pear /Services_Hatena/doc/examples Hatena_Services_Example_01.php
| From: | Makoto Tanaka | Date: | Wed, 22 Mar 2006 16:08:21 +0000 |
| Subject: | cvs: pear /Services_Hatena/doc/examples Hatena_Services_Example_01.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39244@lists.php.net to get a copy of this message | ||
makoto Wed Mar 22 16:08:21 2006 UTC
Added files:
/pear/Services_Hatena/doc/examples Hatena_Services_Example_01.php
Log:
Initial commit
http://cvs.php.net/viewcvs.cgi/pear/Services_Hatena/doc/examples/Hatena_Services_Example_01.php?view=markup&rev=1.1
Index: pear/Services_Hatena/doc/examples/Hatena_Services_Example_01.php
+++ pear/Services_Hatena/doc/examples/Hatena_Services_Example_01.php
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Test Script
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did
not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Services
* @package Services_Hatena
* @author Makoto Tanaka
* @copyright 2006 Makoto Tanaka
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
* @version CVS: $Id: Hatena_Services_Example_01.php,v 1.1 2006/03/22 16:08:21 makoto Exp $
*/
require_once 'Services/Hatena.php';
// $type = 'Search';
$type = 'Autolink';
// $type = 'Bookmarknum';
// $type = 'Asin';
// $type = 'Similar';
// $type = 'Exist';
$datum = array( 'Search' => 'PHP',
'Autolink' => 'I like PHP.',
'Bookmarknum' => 'http://www.yahoo.co.jp/',
'Asin' => '4774124966',
'Similar' => 'PHP',
'Exist' => 'http://www.yahoo.co.jp',
);
$data = $datum[$type];
$hatena = Services_Hatena::factory($type);
if (PEAR::isError($hatena)) {
print('i have an Error : ' . $hatena->getMessage());
exit();
}
/**
* @note
* only for autolink
*
$hatena->setScore(0);
$hatena->setCname(array('food', 'movie'));
$hatena->setTarget('_blank');
$hatena->setClass('keyword');
*/
$result = $hatena->execute($data);
var_dump($result);
?>