/**** PROBLEMAS ENCONTRADOS ****
	//Miami: 1433 NO HAY DATA
	//Encontramos fechas sin end date en Campañas
****
****/
$countries = array('1033', '1409', '1410', '1411', '1412', '1413');
//$countries = array('1413');
foreach ($countries as $keyCountry) {
    echo '<br>COUNTRY to PROCESS: ' . $keyCountry . '<br>';
    $account_id = $keyCountry;
    $application_key = 'bee5OoyaaeMooj3afo6iet9A';
    $private_key = 'xir8If9ameecae1VieBua3oo';
    $email = 'alejandro.sanchez@starcom.com.mx';
    $password = 'Starcom00$';
    # Create an instance of perl client which use the the spore route file
    $client = new Spore('../route_config/route_config.prod.yaml');
    // authentication
    $client->enable('AddHeader', array('header_name' => 'X-Weborama-Account_Id', 'header_value' => $account_id));
    $client->enable('Spore_Middleware_Weborama_Authentication', array('application_key' => $application_key, 'private_key' => $private_key));
    $authenticate = $client->get_authentication_token(array('format' => 'json', 'email' => $email, 'password' => $password));
    $token = 'KDoTYLcWzUwRvbCB84Dr5Xw0csU';
    $client->enable('AddHeader', array('header_name' => 'X-Weborama-UserAuthToken', 'header_value' => $authenticate->body->token));
    //headers_list
    //***********************************
    /*$result = $client->get_statistics(
          array( 
              'format' => 'json',
              'account_id' => $account_id,
              'dimensions' => json_encode(array('project','channel','campaign','ad_space','creative')),
              'metrics' => json_encode(array('impression','click','click_rate','click_adwords','bounce_rate','contribution','unique_click','daily_unique_impression','conversion_rate_impression',
                  'conversion_rate_click','reach_click','daily_unique_user_play','average_conversion_time','average_cost_adwords','cost_adwords','average_expand_time',
Esempio n. 2
0
header('Content-Type: text/html; charset=utf-8');
require_once '../PHP-Spore-master/lib/Spore.php';
require_once '../PHP-Spore-master/lib/Header.php';
require_once '../PHP-Spore-master/lib/SporeMiddleware.php';
set_time_limit(0);
$countries = array('1033');
foreach ($countries as $keyCountry) {
    echo '<br>COUNTRY to PROCESS: ' . $keyCountry . '<br>';
    $account_id = $keyCountry;
    $application_key = 'bee5OoyaaeMooj3afo6iet9A';
    $private_key = 'xir8If9ameecae1VieBua3oo';
    $email = 'alejandro.sanchez@starcom.com.mx';
    $password = 'Starcom00$';
    # Create an instance of perl client which use the the spore route file
    $client = new Spore('../route_config/route_config.prod.yaml');
    // authentication
    $client->enable('AddHeader', array('header_name' => 'X-Weborama-Account_Id', 'header_value' => $account_id));
    $client->enable('Spore_Middleware_Weborama_Authentication', array('application_key' => $application_key, 'private_key' => $private_key));
    $authenticate = $client->get_authentication_token(array('format' => 'json', 'email' => $email, 'password' => $password));
    $token = 'KDoTYLcWzUwRvbCB84Dr5Xw0csU';
    $client->enable('AddHeader', array('header_name' => 'X-Weborama-UserAuthToken', 'header_value' => $authenticate->body->token));
    //headers_list
    //***********************************
    /*$result = $client->get_statistics(
          array( 
              'format' => 'json',
              'account_id' => $account_id,
              'dimensions' => json_encode(array('project','channel','campaign','ad_space','creative')),
              'metrics' => json_encode(array('impression','click','click_rate','click_adwords','bounce_rate','contribution','unique_click','daily_unique_impression','conversion_rate_impression',
                  'conversion_rate_click','reach_click','daily_unique_user_play','average_conversion_time','average_cost_adwords','cost_adwords','average_expand_time',