user131008
user131008

Reputation: 77

Alexa api in php

This is their sample I don't know how to get it working. http://aws.amazon.com/code/AWIS/402

It keeps showing: Usage: $argv[0] ACCESS_KEY_ID SECRET_ACCESS_KEY site\n It is not working, when you fill in:

 $urlInfo = new UrlInfo("myaccessKeyId", "mysecretAccessKey", "stackoverflow.com");

How do I fix this issue?

 public function UrlInfo($accessKeyId, $secretAccessKey, $site) {
        $this->accessKeyId = $accessKeyId;
        $this->secretAccessKey = $secretAccessKey;
        $this->site = $site;
    }

/**
 * Get site info from AWIS.
 */ 
public function getUrlInfo() {
    $queryParams = $this->buildQueryParams();
    $sig = $this->generateSignature($queryParams);
    $url = 'http://' . self::$ServiceHost . '/?' . $queryParams . 
        '&Signature=' . $sig;
    $ret = self::makeRequest($url);
    echo "\nResults for " . $this->site .":\n\n";
    self::parseResponse($ret);
}

Upvotes: 1

Views: 823

Answers (1)

sachleen
sachleen

Reputation: 31141

The script is meant to be run from the command line like so:

php urlinfo.php ACCESS_KEY_ID SECRET_ACCESS_KEY site

It's in the readme. If you just want to use the class, you should take out the stuff after line 122 in the php file.

Upvotes: 1

Related Questions