前の記事 «:javascriptでWindows
次の記事 »:CSS,HTML,PHPのマニュアル検索DashBoard

PhpBase - GoogleBaseに投稿するためのPHPライブラリ

2005年12月05日

スポンサード リンク
PhpBase (php library for submiting to Google Base)

PhpBase Logo  PhpBase Diagram

GoogleBaseに投稿するためのPHPライブラリが公開されました。
クラスベースで結構使いやすくなってるみたいです。内部的にはFTPを使ってるみたいなんですがGoogleBaseってFTPでUPできるんですかね。
次のように簡単なコードでGoogleBaseへの投稿が可能になります。
<?php

require_once('phpbase/PhpBase.php');

$PhpBase =& new PhpBase('Housing'); 

$PhpBase->setDomain('example.com'); 

$my_properties = array(
'12-LKF' => 
'title'=>'Nice house on the beach'
'description' => 'Nice house with views to bay,
It has an enormous deck for up to 10 boats' 
),
'14-LKF' => 
'title'=>'Apartment in San Francisco'
'description' => 'Cute apartment for sublet in
downtown San Francisco'
),
//.........more properties here
);

if(
$PhpBase->addItems($my_properties)){
    if(
$PhpBase->send('username'
    
'password''filename')){
        echo 
"Data was submitted
        successfully to Google Base"
;
    }else{
        echo 
"There was an error on
        the FTP connection to Google Base"
;
    }
}else{
    echo 
"Ooops, there where some
    problems when preparing the data feed.
    These are the attributes
    where we found the problems "
;
    echo 
join($PhpBase->getAttributesWithProblems());


if(!
$PhpBase->addItem($single_property_array)){
    echo 
"There was an error on ".
    
$PhpBase->lastError();


$PhpBase->send('username'
'password''filename'); 

?>
スポンサード リンク
あなたのネットサービスを当ブログで紹介します!

投稿者 KJ : 2005年12月05日 09:07 | ブックマークに追加する Subscribe with livedoor Reader
間違いの指摘をしていただける方はメールでお願いします


本を執筆しました。