//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 = '*****@*****.**'; $password = '******'; # 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', 'average_time_spent_on_site','average_visibility_time','cost_per_1000_impressions','cost_per_1000_visibilities','cost_per_click','cost_per_event','click_rate_view', 'cost_per_pageview','daily_unique_frequency','daily_unique_impression','daily_unique_click','expand','expand_rate','funnel1','funnel2','funnel3','funnel4','funnel5',