【问题标题】:How to get reports from Amazon Affiliate如何从 Amazon Affiliate 获取报告
【发布时间】:2013-06-27 07:56:09
【问题描述】:

我在 Github 上找到了这个 PHP-Oara 库 https://github.com/fubralimited/php-oara,并且我已经设置好了一切。

$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'

但我收到以下错误:

Failed to find log in form!

一开始我以为只是登录表单的名称:

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

由于https://affiliate-program.amazon.com 中的名称实际上是sign_in,但是当我将其更改为该名称时,它没有任何作用。

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

提前致谢!

【问题讨论】:

    标签: php report amazon php-oara


    【解决方案1】:

    我使用这个库,但我不使用 credentials.ini,因为我在数据库中拥有所有凭据。

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

    $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);
    

    我可以登录并访问亚马逊数据。也许自从你写了这篇文章以来,图书馆已经有了一些更新。我可以说现在可以了。

    我得到的结果是:

    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 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多