SyncAdCost(); } public function SyncAdCost(){ #今日 $today = date('Y-m-d', strtotime('-1 day')); $stime = strtotime($today); $etime = strtotime($today.' 23:59:00'); $apps = $this->get_config(); foreach($apps as $k=>$app){ $data = $this->get_data($stime, $etime, $app['token'], $app['utime'], $app['cookie']); if(!empty($data)){ //成功获取数据,开始同步入库 foreach($data as $key=>$val){ $params = array(); $params['wexin_appid'] = $app['wexin_appid']; $params['ad_time'] = $today; $params['city'] = $val['city']; $params['cost'] = $val['paid']; $params['exposure_times'] = $val['exp_pv']; $params['click_times'] = $val['clk_pv']; $params['click_rate'] = $val['ctr']; $params['conversion_times'] = $val['comindex']; $params['conversion_cost'] = $val['cpa']; //查看表中是否已有该条数据 $if_e = DB::table('ad_cost')->where('wexin_appid', $params['wexin_appid'])->where('ad_time', $params['ad_time'])->where('city', $params['city'])->first(); if(isset($if_e->id)){ $ret = DB::table('ad_cost')->where('id', $if_e->id)->update($params); }else{ $ret = DB::table('ad_cost')->insert($params); } } } } } public function get_data($stime, $etime, $token, $utime, $cookie){ $url = 'https://mp.weixin.qq.com/promotion/as_rock?action=get_audience_report&args=%7B%22city_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%2C%5C%22exp_pv%5C%22%2C%5C%22clk_pv%5C%22%2C%5C%22ctr%5C%22%2C%5C%22conv_index%5C%22%2C%5C%22conv_index_cpa%5C%22%2C%5C%22conv_index_cvr%5C%22%2C%5C%22comindex%5C%22%2C%5C%22cpa%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%7D%2C%22page%22%3A0%2C%22page_size%22%3A1000%7D%2C%22gender_and_age_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%2C%22gender%22%3A3%7D%2C%22page%22%3A0%2C%22page_size%22%3A1000%7D%2C%22interest_query%22%3A%7B%22query_fields%22%3A%22%5B%5C%22paid%5C%22%5D%22%2C%22query_cond%22%3A%7B%22begin_time%22%3A'.$stime.'%2C%22end_time%22%3A'.$etime.'%2C%22dimension%22%3A1%2C%22pos_type%22%3A999%2C%22interest%22%3A1%7D%2C%22page%22%3A1%2C%22page_size%22%3A1000%2C%22order_cond%22%3A%7B%22field_name%22%3A%22paid%22%2C%22ascending%22%3Afalse%7D%7D%7D&token='.$token.'&appid=&spid=&_='.$utime; $header = [ 'cookie:'.$cookie, //'referer:https://mp.weixin.qq.com/promotion/frame?t=ad_system/common_frame&t1=campaign/data_stats&token=2668231205', //'authority:mp.weixin.qq.com', //'x-requested-with:XMLHttpRequest', //'accept-encoding:gzip, deflate, br', //'user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', ]; $result = $this->curl($url, $header); return $result; } public function get_config(){ $array = [ [ 'wexin_appid' => 'wx67d996b213022be0', 'token' => '2838348741', 'utime' => '1569577667158', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; mmad_session=1224e37c262d2de17468a0dcdc2b1500ba9b70b7db751f6c7106231cb50edde9428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c673d5d91b3861b782816e59fe8961ceb2a558aeda99bd477aa4478263d861466f78e9096edc0873f62e33114dbc517f1c38b1645f1f21250215f766194b0fa00b618861144cfd99c81feecd3a472ac106dc; data_bizuin=3562897271; data_ticket=rMmoh+rOJJ19Z/xyP7nqyarmqZr1zKc7bgkXhTyVeURDZG7bzSWKmuQkv0kp/LXx; sp_login_mark=156957482049102', ], [ 'wexin_appid' => 'wx47cc02c5ec7baec5', 'token' => '315211287', 'utime' => '1569581763756', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; mmad_session=915443d18e865b4ef6e3927b8943e8cfdbf775f85660e957a17202ea64eca4a6428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6733b021c238f8a7ecba45f7fff1bf464986263fb8e374365a9e2c371184ebd0c38e9096edc0873f62e33114dbc517f1c38506cf0feead42d08059beea34cfd583b8861144cfd99c81feecd3a472ac106dc; data_bizuin=3873173804; data_ticket=k9lXqAaXqYUbaL6HKcRUNlVwmufmBtGEouhmgZf7m9REcEqHYj10htHtma2fiHUT; sp_login_mark=156958172398246; ts_last=mp.weixin.qq.com/promotion/frame', ], [ 'wexin_appid' => 'wxe8a89637887547b2', 'token' => '2101716434', 'utime' => '1569581895875', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=788a9e137132421500011fe5fb7d14c30ab5ddba407bed3b2a76ff4a9819b0bc428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6734d59e76de449caf2e808f22b65fbe6be331b0b121e235a186a67d7b97980e325e9096edc0873f62e33114dbc517f1c384b1532ea8d46847c5836f611553d39338861144cfd99c81feecd3a472ac106dc; data_bizuin=3879199417; data_ticket=iCVPRKf85T7+FgJoqDegDgJGnvyaxq/1o5Eg7/Wc+eUl2Y9iJeCVfqXTgihiWOS5; sp_login_mark=156958188069084', ], [ 'wexin_appid' => 'wx72b9cbf593b39b3d', 'token' => '2464164730', 'utime' => '1569582041958', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=6233ce3f6e6a124d158bbe56e4113352f79714c4bffb3efe8d107f71d0ffe3eb9b9948254aa41e2dcd83c249f9b7f60a7c92673ce321651d1b1498ecce4922ca54ab7b720d2f934c25e032e9b04f80783304c6f78fb85265c558ffc3dfad51c298f9d3bab5dc998ff792eda395846215384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3888174381; data_ticket=XAJELocJr1RHfQ+6vxwnXhGzRPsqZvikz63+GSaBqvD5gdQbOH2+mbbP5efocrSp; sp_login_mark=156958202162377', ], [ 'wexin_appid' => 'wxbfaf520646dc92f2', 'token' => '866566173', 'utime' => '1569582150581', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=4f2056eada0e2f18234135128bee7088f237e26fd7d69337bedc8094ccff12f2428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67342f5c4b84fe256d37c45f44aa7b5639861c677fc8de6842d514f5b4b7704b926e9096edc0873f62e33114dbc517f1c388fe6c4202de572bd51ec9b3ab6f4ba838861144cfd99c81feecd3a472ac106dc; data_bizuin=3885085389; data_ticket=tRQmM+ZV/Zr4TJtZKqETZiUw76ZRqT0QUAYdQy0sk6tbLgD8ZXShcsR1Z9HRoeSG; sp_login_mark=156958211327970', ], [ 'wexin_appid' => 'wxd674fe3adf8aaca4', 'token' => '3070490779', 'utime' => '1569582247685', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=e9c5f4711cddf41a13b5ce1d280cdc5785f5743ca877aeab5099a8c2094e61f49b9948254aa41e2dcd83c249f9b7f60a485edd79a51ac5974160f7461d4fca0e0e710b3cd44c91959e13a930f938d1523304c6f78fb85265c558ffc3dfad51c24e76414042a06b80ad977e4d2cea8abd384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3561765436; data_ticket=98NaKblb3gVxO2QaEDmO/vZXGms+HBGuipXaxfwDJSPk5pVut38Un0F/iVNlrn34; sp_login_mark=156958221282774', ], [ 'wexin_appid' => 'wx49983d60c92fa52f', 'token' => '1718060682', 'utime' => '1569582326452', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=6c6207c3b97a5ca051d8a09b2725b2e4fa16d1d2686760b2abdecb7825c58e25ff40ddc6884c6993c617353cb71da1a3b99ee5c1592f35e9ac399e2308a6b4f738bb7a02c9a1cd0d1c2bbe431b5b5d5b637da209a0189b71482e6e92650c9f90978f8ed1c5941ca47717ba1f349b071f2470aeb12bd6e0743537b3af0d0359ab3a10096921400f2cc68d80f78c742b3b; data_bizuin=3576820018; data_ticket=0/WL1jSSSd0CPESE5xS2pESGSEWAWJhuOpdCRQt096p2J41PmZU4M00yX4ogAOT1; sp_login_mark=156958230248313', ], [ 'wexin_appid' => 'wxd5de545eda56fe72', 'token' => '4026955015', 'utime' => '1569582436875', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; data_bizuin=3593805607; mmad_session=516d46449be318ede5f154ca87e29213cf8af65080e21d7564c042ef1624f0dfff40ddc6884c6993c617353cb71da1a32b6bd211d3736fbf804b00b4d4251c7f5ce6af242dde87ef19384a952c043424637da209a0189b71482e6e92650c9f908fc4a235140a01b0c1e2cc0c7f614b05f4ce8953464cbb21fd45f4b28b486e213a10096921400f2cc68d80f78c742b3b; data_ticket=gEuCwnl9d+tQ9glTdx8XOmLn7KVoTExC5ASUckZq1ZuzY11NM9fII4t4Bl+nIO/T; sp_login_mark=156958242518479', ], [ 'wexin_appid' => 'wxd4b6710f28ac9ca7', 'token' => '3551468263', 'utime' => '1569582512634', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=697551a90cfbf867b8a55e3581541f99518c01ac2b749fcf6f161dd909dabe29428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c673a7ccf90fe1b4d33f5105916d6cbc4018d37b17d99c00024a5a8b95558c60c1fae9096edc0873f62e33114dbc517f1c38d143346ea4b5aa20ab79bd925214b1578861144cfd99c81feecd3a472ac106dc; data_bizuin=3865173364; data_ticket=Fhn6TMCNhaPItbomVWqUtli0S3UY0UgsEgcVMbfSHZ24FpEQlDBdW3NcCiGuSCHp; sp_login_mark=156958250220358', ], [ 'wexin_appid' => 'wxefb2d250fd5ab419', 'token' => '531215198', 'utime' => '1569582570381', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=feac8b05849714a59850e21afb925f28f901831a5571816ce560468d86de6a90ff40ddc6884c6993c617353cb71da1a32cf662f71841709c1471afe48a8db3063882d9481bffd0312803bebadfb9796e637da209a0189b71482e6e92650c9f90fb0e5506abc90f8fc3b92a4b9600fd678dc0ac65ad354857aef2fa1366e9515c3a10096921400f2cc68d80f78c742b3b; data_bizuin=3587791882; data_ticket=MWetN7KD6BfSclbDD8R6ck0iyq+Xddq9YVD0eRcWhyGp6vNec52pDgyummAJ2Unn; sp_login_mark=156958256127993', ], [ 'wexin_appid' => 'wx6d6d1d8bbbf69271', 'token' => '2753254932', 'utime' => '1569582624642', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=8ba5ed0cefc4fe59074dd254a901ad16ec7f7282756ad9d4e75adcf82f41200b9b9948254aa41e2dcd83c249f9b7f60a3236f848d7acfddb55ef09ee612d0299b9246cc2abe5908e51f19822783f33b33304c6f78fb85265c558ffc3dfad51c2daa7aa497a0a18c17948553694233244384d73f8cccd1df624704a0299b23ee8f5cb5b284c6cbb547c2e4c165d68878c; data_bizuin=3864061076; data_ticket=YWGb3JqR35at/Fk/P0dcDrtULbPcs9fkcVJgeCMQyLj4SmIaFg30qKzPsBSSY+TJ; sp_login_mark=156958261696194', ], [ 'wexin_appid' => 'wx8d9019183bdd8529', 'token' => '3897248071', 'utime' => '1569582688771', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; eas_sid=f1v594k1q0x5X4u4K9E9h8a163; LW_sid=312574H1D0K5H4F5872208P6O1; LW_uid=a1X5K4Z1C0R5O4t5P712N866R2; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; pgv_info=ssid=s4130685694; pgv_si=s6199242752; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=550e8a1d9ddf9a5e333ed8213b3442db89a4e88a930e1c10c1ccf4c44417b84cd5ddc3b83eb6bdcc6d0fb67b14a597152fe9dbbe2854ac633d6c321e4ffaf37a5d95b0e65279d1470587946222e83f5c3335d28f793fa360a15607202cde5ec50a972c4a47b45795a64536c7c1626b3d68d8d9e9d6fbe2c355b4e8a29630ab20a0cd14724db066fdc2f299b0d42ca6e3; data_bizuin=3863254099; data_ticket=d4GaAlqqdc2DA990jKzRFqjJQ44JLw/eTGHHH7TBMG4AwrDbozD7OBVk4c7iIAwp; sp_login_mark=156958267893066', ], [ 'wexin_appid' => 'wx81c666056498ba69', 'token' => '2354365122', 'utime' => '1576573025263', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=8e87f160eb6c869daf5fad45360438970712ca152885245897b1bc0eed99340b428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67393bbcd81fe1dfe5cc637a8ccf08d3709373a316c0b46530d4e12fec46c346daee9096edc0873f62e33114dbc517f1c3850877ccf0388f430eb45034bb00daf758861144cfd99c81feecd3a472ac106dc; data_bizuin=3896159180; data_ticket=PLEGJwFzQ33UGOkFhdS2t53iQmVde/39NoL7wBFUNB9FryurIQbK1lSdX8GLk3if; sp_login_mark=157657295994230', ], [ 'wexin_appid' => 'wx458690ee4642e62e', 'token' => '2839801746', 'utime' => '1576573436556', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=0e6a4e99eab6bba7c3f73c10b466ff1a1825dc3ec8fd7fc2b716e306e8b09481428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67323d3d63051a2c8a1f2095f5523274f5373c532cc14b0ae57399bd2f661c6d888e9096edc0873f62e33114dbc517f1c387e89230ee6520667a448f3bb992135b98861144cfd99c81feecd3a472ac106dc; data_bizuin=3888202971; data_ticket=GlPQBf9FSnVcECK2y1qHmTfT6gVAOH8KrwCm23Jv8DnRlAO8A9Rp94Mm+/fftFzA; sp_login_mark=157657341380488', ], [ 'wexin_appid' => 'wx9592760088e842ab', 'token' => '1989957288', 'utime' => '1576573511091', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; mmad_session=f7f65e526a68ce5343bd6b9cc2424f34932f8188d1c4837bba0e401afa0f0c78428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c6732dc82ca2348ad7c77e6d15381dc02afaef01b3c1f57a04929211378a0753f490e9096edc0873f62e33114dbc517f1c38b4227dd311b2910e594df697ba80f9ee8861144cfd99c81feecd3a472ac106dc; data_bizuin=3867155174; data_ticket=Nxq+i9hUNgqme6C/jZ7CeGeAxr22DipVTF6/oL/CRb5dA9YPlyH4qPylll8pv81L; sp_login_mark=157657349849268', ], [ 'wexin_appid' => 'wx93a67b889a197fd6', 'token' => '1803672793', 'utime' => '1576573590018', 'cookie' => 'pgv_pvi=4386111488; pgv_pvid=8219519430; ua_id=4RiWEsOjRygytEr8AAAAAJojy3bilFhK5De7Wl_fjGo=; pt2gguin=o0405069212; RK=COBkSw1wTP; ptcz=6b4a07b633d8c36e33c7b58b595f72a6e943c2e71c965cbd419b3c5bff8a2103; sd_userid=74851549952893489; sd_cookie_crttime=1549952893489; _ga=GA1.2.270766756.1552372375; xid=6481f460de64bcd29373fe30de9c82c6; o_cookie=405069212; pac_uid=1_405069212; tvfe_boss_uuid=fed80036aa051242; ts_uid=2339521966; ied_qq=o0405069212; LW_sid=X1c5h7H122H8I8k57883L2s3N0; pgv_info=ssid=s526899100; ts_last=mp.weixin.qq.com/promotion/frame; data_bizuin=3589921537; mmad_session=57fe24bb1e1f9e4a5f2e959c545cc13e6b52e0c0ffcb904e36f47a14037d2d5d428ea9a5bbcdbbe01e9e5f954536346ce04dbf0f6d7c3f0c702ffe25f6a4c67388c2c75620e1347967f4e2b3bec9e6cab4779489053af726a7dd60171be53732e9096edc0873f62e33114dbc517f1c388adc2f1932efd765f09ba88df59e97198861144cfd99c81feecd3a472ac106dc; data_ticket=KKI+HUO6zznU+rrpGGbNfaxqtH6wugNYrjaXGBCANvxcGhDXlezPHHQosA0GmRPG; sp_login_mark=157657356982482', ], ]; return $array; } public function curl($url, $header){ //$url = urlencode($url); //echo $url;exit; $ch = curl_init();//初始化curl curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER, 0);// curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//绕过ssl验证 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($ch);//运行curl curl_close($ch); $data = json_decode($data,true); if(isset($data['city_datas']) && !empty($data['city_datas'])){ return $data['city_datas']; }else{ return false; } } }