NAME

WebService::Search123 - Interface to the Search123 API.

VERSION

Version 0.05

SYNOPSIS

The Search123 API interface.

use WebService::Search123;

my $s123 = WebService::Search123->new( aid => 99999 );

foreach my $ad ( $s123->ads )
{
   print $ad->title;
}

DESCRIPTION

Interface to the Search123 platform for searching for ads.

use WebService::Search123;

$WebService::Search123::DEBUG = 1;

my $s123 = WebService::Search123->new(
    aid      => 10057,
    keyword  => 'ipod',
    per_page => 5,
    client   => {
        ip   => '88.208.204.52',
        ua   => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.8 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.8',
        ref  => 'http://www.ultimatejujitsu.com/jujitsu-for-beginners/',
    },
);

binmode STDOUT, ":encoding(UTF-8)";

foreach my $ad ( $s123->ads )
{
    print $ad->title . "\n";
}

METHODS

Attributes

ua

$s123->ua

The internal LWP::UserAgent to use.

secure

$s123->secure( 1 );

Flag to indicate whether to use https or http (default).

aid

$s123->aid( 99999 );

Your account ID with Search123.

keyword

The user-supplied keywords to search against.

$s123->keyword( 'ipod' );

per_page

The number of results requested.

$s123->per_page( 5 );

ads

The returned list of ad objects based on the criteria supplied.

See WebService::Search123::Ad for details on these objects.

foreach my $ad ( $s123->ads ) { ... }

client

A hash-reference containing details about your end user, including IP address, user-agent string, and the page they're on to view the ads.

You should set this at construction time.

Set and get methods are available as set_client() and get_client.

$s123->set_client( ip => '127.0.0.1' );

session

The session string/cookie to send with each request.

You should store this in a cookie and re-use it for 30 minutes as per the Search123 documentation.

$s123->session

request_time

How long the underlying HTTP API request took.

$s123->request_time;