nticaric/awis

PHP package for making requests to Alexa Web Information Service

v1.0 2016-08-17 15:16 UTC

This package is auto-updated.

Last update: 2024-09-20 01:13:53 UTC


README

PHP package for making requests to Alexa Web Information Service

##Installation

The easiest way to install Awis is via composer. Create the following composer.json file and run the php composer.phar install command to install it.

{
    "require": {
        "nticaric/awis": "dev-master"
    }
}

Examples

UrlInfo

The UrlInfo action provides information about a website, such as:

  • how popular the site is
  • what sites are related
  • contact information for the owner of the site

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $awis->getUrlInfo("example.com");

    //prints the raw xml response
    echo (string) $response->getBody();

The getUrlInfo method supports a second argument that lets you set a valid ResponseGroup. The default is set to ContentData. Possible values for the response group are:

Response Groups

Meta-Response Groups

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $awis->getUrlInfo("example.com", "ContentData");

TrafficHistory

The TrafficHistory action returns the daily Alexa Traffic Rank, Reach per Million Users, and Unique Page Views per Million Users for each day since August 2007. This same data is used to produce the traffic graphs found on alexa.com.

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $awis->getTrafficHistory("example.com");

CategoryBrowse

The CategoryBrowse action and CategoryListings actions together provide a directory service based on the Open Directory, www.dmoz.org, and enhanced with Alexa traffic data.

For any given category, the CategoryBrowse action returns a list of sub-categories. Within a particular category you can use the CategoryListings action to get the documents within that category ordered by traffic.

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $awis->getCategoryBrowse("example.com", "Categories", "Top/Arts");

CategoryListings

The CategoryListings action is a directory service based on the Open Directory, www.dmoz.org. For any given category, it returns a list of site listings contained within that category.

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $awis->getCategoryListings("example.com", "Top/Arts", "Popularity", "False", 1, 20);

SitesLinkingIn

The SitesLinkingIn action returns a list of web sites linking to a given web site. Within each domain linking into the web site, only a single link - the one with the highest page-level traffic - is returned. The data is updated once every two months.

Usage:

    use Nticaric\Awis\Awis;

    $awis = new Awis("ACCESS_KEY_ID", "SECRET_ACCESS_KEY");
    $response = $this->awis->getSitesLinkingIn("example.com");