Created
December 13, 2016 06:56
-
-
Save rc1021/57dc08a128b0ce0a8c06b147f796f33c to your computer and use it in GitHub Desktop.
mailchimp-api取得電子報列表的範例(來源:https://github.com/drewm/mailchimp-api)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 建立 instance | |
| $token = ''; | |
| $MailChimp = new \Drewm\MailChimp($token); | |
| // 取得電子報資源 | |
| $tmp = $MailChimp->call('campaigns/list', $params['args']); | |
| // $tmp['data'] 是電子報列表 | |
| $campaigns = $tmp['data']; | |
| // 判斷是否有電子報列表的資料 | |
| if($campaigns) { | |
| foreach ($campaigns as $key => $campaign) { | |
| // 電子報列表中,每一期(項)的資料 | |
| $campaign | |
| // 取得每一期(項)的封面 | |
| if($campaign['social_card'] and !empty($campaign['social_card']['image_url'])) { | |
| $campaign['social_card']['image_url']; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment