如何从Amazon Affiliate获取报告 [英] How to get reports from Amazon Affiliate

查看:136
本文介绍了如何从Amazon Affiliate获取报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了这个PHP-Oara库 https://github.com/fubralimited/php-oara

I found this PHP-Oara library https://github.com/fubralimited/php-oara at Github and I've already setup everything.

$networkName = "Amazon"; //Ex: AffiliateWindow
//Retrieving the credentials for the network
$config = Zend_Registry::getInstance()->get('credentialsIni');

$configName = strtolower($networkName);
$credentials = $config->$configName->toArray();

//Path for the cookie located inside the Oara/data/curl folder
$credentials["cookiesDir"] = "example";
$credentials["cookiesSubDir"] = $networkName;
$credentials["cookieName"] = "test";

//The name of the network, It should be the same that the class inside Oara/Network
$credentials['networkName'] = $networkName;
//Which point of view "Publisher" or "Advertiser"
$credentials['type'] = "Publisher";
//The Factory creates the object

$network = Oara_Factory::createInstance($credentials);

我还在 credentials.ini中添加了必要的详细信息文件:

;------------Amazon (All the newtwork are available)------------

;The user name used in Amazon associates to log in
amazon.user = 'my amazon affiliate email'

;The password used in Amazon associates to log in
amazon.password = 'my amazon affiliate password'

;Network we are going to log in: uk, es, us, ca, de, fr, it, jp, cn.
amazon.network = 'us'

但是我遇到了以下错误:

But I'm getting the following error:

Failed to find log in form!

我认为起初它只是登录表单的名称:

I thought it was just the name of the login form at first:

if (!preg_match('/<form name="signIn".*?<\/form>/is', $page, $form)) {
    die('Failed to find log in form!');
}

由于 https://affiliate-program.amazon.com 实际上是 sign_in ,但是当我将其更改为

Since the name in https://affiliate-program.amazon.com is actually sign_in but when I changed it to that it didn't have any effect.

,但是真正的问题是 $ page 变量实际上是空的。
是否可以安全地假定该库已损坏,或者我在设置中做错了什么?
您能推荐其他任何可以做同样事情的图书馆吗?或者可能向我指出一些资源,可以帮助我编写自己的图书馆以登录到亚马逊会员网站并获取一些报告。

But the real problem is that the $page variable is actually empty. Is it safe to assume that this library is broken or did I do something wrong with the setup? Can you recommend any other library that can do the same thing or probably point me out to some resources that can help me write my own library for logging into the amazon affiliate website and fetch some reports.

谢谢!

推荐答案

我使用了这个库,但是我没有使用

I use this library, but I don't use the credentials.ini because I've all the credentials in a database.

所以我更改了example / generic.php以编程方式添加了凭据:

So I changed the example/generic.php to add the credentials programmatically:

$email = ...;
$password = ...;
$network = ...;
$networkName = "Amazon";
$networkType = "Publisher";


$credentials = array();

//Path for the cookie located inside the Oara/data/curl folder
$credentials["cookiesDir"] = "example";
$credentials["cookiesSubDir"] = $networkName;
$credentials["cookieName"] = "test";

$credentials["user"] = $email;
$credentials["password"] = $password;
$credentials["network"] = $network;
$credentials['networkName'] = $networkName;
$credentials['type'] = $networkType;

//The Factory creates the object
$network = Oara_Factory::createInstance($credentials);
Oara_Test::testNetwork($network);

我可以登录并访问Amazon数据。也许自从您写了这篇文章之后,对该库进行了一些更新。我可以说现在可以了。

And I can login and access to the Amazon data. Maybe since you had written this post, there has been some updates to the library. I can say that now it works.

我得到的结果是:

Total Number of payments: XX

Number of merchants: XX


importing from 01-08-2013 00:00:00 to 31-08-2013 23:59:59
Number of transactions: XX

Number register on the overview: XX


importing from 01-09-2013 00:00:00 to 30-09-2013 23:59:59
Number of transactions: XX

Number register on the overview: XX


importing from 01-10-2013 00:00:00 to 05-10-2013 23:59:59
Number of transactions: XX

Number register on the overview: XX

Import finished 

这篇关于如何从Amazon Affiliate获取报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆