Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Eugene Panin  >  Meta tags fetcher  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Usage exmpale
Class: Meta tags fetcher
Fetches meta tag values from a given Web page
Author: By
Last change:
Date: 2004-11-11 23:43
Size: 885 bytes
 

Contents

Class file image Download
<?php
  
/**
   * Example of META-tags fetching with mtfetcher classes
   */
require_once 'mtfetcher/mtfetcher_Fetcher.php';

$f = new mtfetcher_Fetcher;

// Selecting transport

//$trName = 'fgc'; // Fetch using 'file_get_contents' PHP-function
//$trName = 'file'; // Fetch using 'file' PHP-function. Simplest way to run.
$trName 'PEAR_Request'// Fetch using PEAR::HTTP_Request class
$trConf = array(); // Configuration of transport. Use this array if you need to configure proxy access and so on

$err $f->selectTransport($trName,$trConf);
if (
PEAR::isError($err)) showError($err);

// Fetching tags
$url "http://www.tortuga.pp.ru/index.php/processor/index/lang/en";
$tags $f->getTags($url);
if (
PEAR::isError($tags)) showError($tags);
print_r($tags);

function 
showError($err) {
  die(
"Error '".$err->getMessage()."' (".get_class($err).")");
}
?>