<?php

// Include the Onpub API files.
include 'onpub/api/onpubapi.php';

try {
  
// Connect to the Onpub database.
  // Replace host, dbname, username, and password with your own DB connection
  // info.
  
$pdo = new PDO"mysql:host=localhost;dbname=test""test""test" );
}
catch ( 
PDOException $e ) {
  
// Database connection error.
  
echo $e->getMessage();
  exit(
1);
}

// Construct the OnpubArticles object using the PDO connection.
// In an abstract sense the OnpubArticles object represents the OnpubArticles
// MySQL table in the Onpub database.
$oarticles = new OnpubArticles($pdo);

// Use the OnpubArticles object to get a specific article from the database
// using its ID, which is 1 in this example.
$article $oarticles->get(1);

// The $article variable now holds an OnpubArticle object. This variable will
// be NULL if there was no article with ID 1 in the database. You can now
// use the OnpubArticle object to output the Article's properties.
echo $article->title '<br>';
echo 
$article->content;

// Articles also have other properties you can output. They are all documented
// here:
// http://onpubco.com/onpubapiref/OnpubAPI/OnpubArticle.html#sec-var-summary

?>