} fputs($fp, "{$campaign->ga_campaign_name},,,,,," . $ag->gag_name . "," . MAX_CPC . "," . DEFAULT_MATCH_TYPE . ",{$v['keyword']},,,,,{$v['url']}\r\n"); fputs($fp, "{$campaign->ga_campaign_name},,,,,," . $ag->gag_name . "," . MAX_CPC . ",Phrase,{$v['keyword']},,,,,{$v['url']}\r\n"); } } } $prev_make = $val['l_make']; if ($kk > 60000) { break 2; } $k = 0; echo $c . "/" . ++$i . "/" . $total . "\r\n"; $ag = new GoogleAdGroup($db); $ag->m_sMainTable = 'vehicles'; $ag->gag_l_id = $val['l_id']; $ag->createName($val); $ag->save(); $ag->m_aKeywords[] = array('keyword' => $val['l_make'], 'url' => "http://vehicles.pingola.ru.msn.com/search/" . str_replace(" ", "+", $val['l_make']) . "?make=" . str_replace(" ", "+", $val['l_make']) . "&share&refGoogle=Network=_{network}_&Keyword=_{keyword}_&MatchType=_{matchtype}_&Ad=_{creative}_&AdPos=_{adposition}_"); $ag->buildAds(array('GoogleAdVehiclesRU', 'GoogleAdVehiclesRU3', 'GoogleAdVehiclesRU4'), $val); //, 'GoogleAdRealEstateRU2', 'GoogleAdRealEstateRU3', 'GoogleAdRealEstateRU4'), $val); if (!$ag->is_has_ads) { echo "no good ads\r\n"; continue; } $c++; if ($c == 2000) { $c = 0; $campaign = new GoogleCampaign($db); $campaign->ga_campaign_name = CAMPAIGN_NAME_BASE . " " . date("Y-m-d H i"); $campaign->save(); }
$i = 0; $c = 0; $main_db->executeSQL("SELECT *, count(*) as cnt FROM realestate\n\tWHERE \tl_deal_type = 0 and \n\t\t\tl_www_id = 1369 and \n\t\t\tl_isActive = 1 and \n\t\t\tl_d_price > 10000 and\n\t\t\tl_assetType = 'Квартира'\n\tGROUP BY \n\t\tl_geo_city \n\tORDER BY \n\t\tcnt DESC \n\tLIMIT 20", $resultArry, $rowsAffected); if (!$rowsAffected) { break; } $total = $rowsAffected; foreach ($resultArry as $val) { $campaign = new GoogleCampaign($db); $campaign->ga_campaign_name = "Real Estate Sale " . $val['l_geo_city']; $campaign->save(); echo $c . "/" . ++$i . "/" . $total . "\r\n"; $ag = new GoogleAdGroup($db); $ag->m_sMainTable = 'realestate'; $ag->gag_l_id = $val['l_id']; $ag->createName(); $ag->save(); $ag->buildAds(array('GoogleAdRealEstateRU5', 'GoogleAdRealEstateRU6', 'GoogleAdRealEstateRU7', 'GoogleAdRealEstateRU12', 'GoogleAdRealEstateRU13'), $val); $ag->buildRealestateKeywordsRU($val); $ag->saveAds($fp, $campaign->ga_campaign_name); if (!$ag->is_has_ads) { echo "no good ads\r\n"; continue; } $ag->m_aKeywords = array_unique($ag->m_aKeywords); foreach ($ag->m_aKeywords as $val2) { fputs($fp, "{$campaign->ga_campaign_name},,,,,," . $ag->gag_name . "," . MAX_CPC . "," . DEFAULT_MATCH_TYPE . ",{$val2}\r\n"); } $c++; $main_db->executeSQL("SELECT *, count(*) as cnt FROM realestate\n\tWHERE \tl_deal_type = 1 and \n\t\t\tl_www_id = 1369 and \n\t\t\tl_isActive = 1 and \n\t\t\tl_d_price > 1000 and\n\t\t\tl_geo_city LIKE '%{$val['l_geo_city']}%' and\n\t\t\tl_assetType = 'Квартира'\n\tGROUP BY \n\t\tl_geo_city \n\tORDER BY \n\t\tcnt DESC \n\tLIMIT 1", $resultArry2, $rowsAffected2); echo $c . "/" . ++$i . "/" . $total . "\r\n";