コード例 #1
0
ファイル: estraierpure.php プロジェクト: bermi/akelos
 /**
  * Edit attributes of a document.
  *
  * @param   object  $doc    EstraierPure_Document
  *                          which is a document object.
  * @return  bool    True if success, else false.
  * @access  public
  */
 public function edit_doc(EstraierPure_Document $doc)
 {
     $this->status = -1;
     if (!$this->url) {
         return false;
     }
     $turl = $this->url . '/edit_doc';
     $reqheads = array('Content-Type' => 'text/x-estraier-draft');
     if ($this->auth) {
         $reqheads['Authorization'] = 'Basic ' . base64_encode($this->auth);
     }
     $reqbody = $doc->dump_draft();
     $rv = EstraierPure_Utility::shuttle_url($turl, $this->pxhost, $this->pxport, $this->timeout, $reqheads, $reqbody);
     if (PEAR::isError($rv)) {
         return false;
     }
     $this->status = $rv;
     return $rv == 200;
 }
コード例 #2
0
ファイル: register.php5 プロジェクト: joeymetal/v1
<?php
define('ESTRAIERPURE_DEBUG', 1);
//define('ESTRAIERPURE_USE_HTTP_STREAM', 1);
error_reporting(E_ALL & ~E_STRICT);
require_once 'estraierpure.php5';

// create and configure the node connecton object
$node = new EstraierPure_Node;
$node->set_url('http://*****:*****@uri', 'http://estraier.example.com/example.txt');
$doc->add_attr('@title', 'Bridge Over The Troubled Water');

// add the body text to the document object
$doc->add_text('Like a bridge over the troubled water,');
$doc->add_text('I will ease your mind.');

// register the document object to the node
if (!$node->put_doc($doc)) {
    fprintf(STDERR, "error: %d\n", $node->status());
    if (EstraierPure_Utility::errorstack()->hasErrors()) {
        fputs(STDERR, print_r(EstraierPure_Utility::errorstack()->getErrors(), true));
    }
} else {
    fputs(STDOUT, "success.\n");
}