{"id":1736,"date":"2016-08-02T20:32:37","date_gmt":"2016-08-02T20:32:37","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1736"},"modified":"2016-08-03T16:35:50","modified_gmt":"2016-08-03T16:35:50","slug":"add-subscriber-to-list-mailchimp-api-php","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/","title":{"rendered":"Add Subscriber to List using MailChimp API and PHP"},"content":{"rendered":"<p>MailChimp is an email marketing service, helps to manage the subscribers of your website. MailChimp provides an easy way to integrate email signup form in your website and send the email newsletter to the subscriber. Beside the premium plan MailChimp also has a forever free plan. Using the free plan, you can add up to 2,000 subscribers to MailChimp and send 12,000 emails per month to the subscriber.<br \/>\nIn this tutorial, we&#8217;ll show you how to integrate newsletter subscription form in your website and add subscriber to list with MailChimp using PHP. We&#8217;ll use MailChimp API 3.0 and PHP to add subscriber to list without confirmation email.<br \/>\nTo integrate <b>MailChimp API in PHP<\/b> you need a MailChimp <b>API Key<\/b> and <b>List ID<\/b> where you want to add members. Before you begin, sign up for a MailChimp account and follow the below steps to get API Key and List ID.<\/p>\n<h2>Creating API Key and List ID<\/h2>\n<h3>Get API Key:<\/h3>\n<ul class=\"step_list\">\n<li>Login to your MailChimp account.<\/li>\n<li>Under the user menu dropdown at the top left side, click on <b>Account<\/b> link.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-user-account-codexworld.png\" alt=\"custom-subscription-form-mailchimp-api-php-user-account-codexworld\" width=\"470\" height=\"326\" class=\"alignnone size-full wp-image-1738\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-user-account-codexworld.png 470w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-user-account-codexworld-300x208.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-user-account-codexworld-200x139.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-user-account-codexworld-332x230.png 332w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/div>\n<\/li>\n<li>Go to the <b>Extras &raquo; API Keys<\/b> from the top navigation menu.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld.png\" alt=\"custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld\" width=\"692\" height=\"240\" class=\"alignnone size-full wp-image-1739\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld.png 692w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld-300x104.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld-200x69.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/custom-subscription-form-mailchimp-api-php-extras-api-keys-codexworld-346x120.png 346w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<div>\n<\/li>\n<li>Under the <b>Your API keys<\/b> section, create an API Key by clicking on <b>Create A Key<\/b> button. Once generated, copy <b>API key<\/b> for later use in PHP script.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-1024x304.png\" alt=\"add-subscriber-to-list-mailchimp-api-key-codexworld\" width=\"960\" height=\"285\" class=\"alignnone size-large wp-image-1740\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-1024x304.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-300x89.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-768x228.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-200x59.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld-346x103.png 346w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-key-codexworld.png 1046w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<\/li>\n<\/ul>\n<h3>Get List ID:<\/h3>\n<ul class=\"step_list\">\n<li>Choose a list in which all the subscriber&#8217;s information would be stored. In that case, you need to create a list in the <b>Lists<\/b> page.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-1024x376.png\" alt=\"newsletter-subscription-form-integration-php-mailchimp-list-codexworld\" width=\"960\" height=\"353\" class=\"alignnone size-large wp-image-1741\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-1024x376.png 1024w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-300x110.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-768x282.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-200x73.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld-346x127.png 346w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/newsletter-subscription-form-integration-php-mailchimp-list-codexworld.png 1033w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/div>\n<\/li>\n<li>Enter into your created list and navigate to <b>Settings &raquo; List name and campaign defaults<\/b>.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld.png\" alt=\"add-subscriber-to-list-mailchimp-api-php-settings-codexworld\" width=\"866\" height=\"255\" class=\"alignnone size-full wp-image-1742\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld.png 866w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld-300x88.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld-768x226.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld-200x59.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-settings-codexworld-346x102.png 346w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/div>\n<\/li>\n<li>Under the <b>List ID<\/b> label you will find the List ID. Copy <b>List ID<\/b> for later use in PHP script.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-list-id-codexworld.png\" alt=\"add-subscriber-to-list-mailchimp-api-php-list-id-codexworld\" width=\"444\" height=\"128\" class=\"alignnone size-full wp-image-1743\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-list-id-codexworld.png 444w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-list-id-codexworld-300x86.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-list-id-codexworld-200x58.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-mailchimp-api-php-list-id-codexworld-346x100.png 346w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/div>\n<\/li>\n<\/ul>\n<p>In our example script, a simple newsletter subscription form will be implemented. Once the user submits the subscription form along with the details (First Name, Last Name, and Email), respective details would be added to the list of MailChimp account using MailChimp API and PHP. Also, the subscriber would be able to receive the newsletter of your website via MailChimp.<\/p>\n<h2>Subscription Form (index.php)<\/h2>\n<p>The <code>index.php<\/code> file contains the custom subscription form HTML. The subscriber needs to enter their First Name, Last Name, and Email. By clicking on <b>SUBSCRIBE<\/b> button, the form will submit to the <code>action.php<\/code> file for adding the subscriber to the MailChimp subscriber list.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;session_start<\/span><span style=\"color: #007700\">();&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;place&nbsp;it&nbsp;on&nbsp;the&nbsp;top&nbsp;of&nbsp;the&nbsp;script&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<br \/>&lt;?php<br \/>&nbsp;&nbsp;&nbsp;&nbsp;$statusMsg&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;!empty(<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">])?<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">]:<\/span><span style=\"color: #DD0000\">''<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;unset(<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #0000BB\">$statusMsg<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n\r\n&lt;<span style=\"color:#bf4f24\">form<\/span> <span style=\"color:#bf4f24\">method<\/span>=<span style=\"color:#0b6125\">\"post\"<\/span> <span style=\"color:#bf4f24\">action<\/span>=<span style=\"color:#0b6125\">\"action.php\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>&lt;<span style=\"color:#bf4f24\">label<\/span>>First Name: &lt;\/<span style=\"color:#bf4f24\">label<\/span>>&lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"fname\"<\/span> \/>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>&lt;<span style=\"color:#bf4f24\">label<\/span>>Last Name: &lt;\/<span style=\"color:#bf4f24\">label<\/span>>&lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"lname\"<\/span> \/>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>&lt;<span style=\"color:#bf4f24\">label<\/span>>Email: &lt;\/<span style=\"color:#bf4f24\">label<\/span>>&lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"text\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"email\"<\/span> \/>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">p<\/span>>&lt;<span style=\"color:#bf4f24\">input<\/span> <span style=\"color:#bf4f24\">type<\/span>=<span style=\"color:#0b6125\">\"submit\"<\/span> <span style=\"color:#bf4f24\">name<\/span>=<span style=\"color:#0b6125\">\"submit\"<\/span> <span style=\"color:#bf4f24\">value<\/span>=<span style=\"color:#0b6125\">\"SUBSCRIBE\"<\/span>\/>&lt;\/<span style=\"color:#bf4f24\">p<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">form<\/span>>\r\n<\/pre>\n<h2>Add subscriber to MailChimp List (action.php)<\/h2>\n<p>In the <code>action.php<\/code> file, subscription form data is received and send the subscriber details to the MailChimp using MailChimp API and PHP. To Use MailChimp API, you need to mention API Key and List ID. Insert the API Key and List ID which you&#8217;ve got in the previous step.<br \/>\nHere cURL is used to send an HTTP POST request to the List Members endpoint with member information. After adding the subscriber to MailChimp list, the call returns a response. Based on the response (<code>$httpCode<\/code>), the status message would be shown to the subscriber.<br \/>\nTo add a subscriber, you must include the subscriber&#8217;s status in your JSON object. If you include the subscriber&#8217;s status <code>subscribed<\/code>, subscriber email address would be added right away without sending a confirmation email. Use <code>pending<\/code> status to send a confirmation email to subscriber.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/>session_start<\/span><span style=\"color: #007700\">();<br \/>if(isset(<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'submit'<\/span><span style=\"color: #007700\">])){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$fname&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'fname'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$lname&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'lname'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$email&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'email'<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;if(!empty(<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">)&nbsp;&amp;&amp;&nbsp;!<\/span><span style=\"color: #0000BB\">filter_var<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">FILTER_VALIDATE_EMAIL<\/span><span style=\"color: #007700\">)&nbsp;===&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;MailChimp&nbsp;API&nbsp;credentials<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$apiKey&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'InsertMailChimpAPIKey'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$listID&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'InsertMailChimpListID'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;MailChimp&nbsp;API&nbsp;URL<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$memberID&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">md5<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">strtolower<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">));<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$dataCenter&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">substr<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$apiKey<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">strpos<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$apiKey<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'-'<\/span><span style=\"color: #007700\">)+<\/span><span style=\"color: #0000BB\">1<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$url&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'https:\/\/'&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$dataCenter&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #DD0000\">'.api.mailchimp.com\/3.0\/lists\/'&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$listID&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #DD0000\">'\/members\/'&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$memberID<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;member&nbsp;information<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$json&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">json_encode<\/span><span style=\"color: #007700\">([<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'email_address'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'status'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'subscribed'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #FF8000\"><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'merge_fields'&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;[<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'FNAME'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$fname<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'LNAME'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$lname<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">]<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;send&nbsp;a&nbsp;HTTP&nbsp;POST&nbsp;request&nbsp;with&nbsp;curl<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$ch&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">curl_init<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$url<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_USERPWD<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'user:'&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$apiKey<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_HTTPHEADER<\/span><span style=\"color: #007700\">,&nbsp;[<\/span><span style=\"color: #DD0000\">'Content-Type:&nbsp;application\/json'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_RETURNTRANSFER<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_TIMEOUT<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">10<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_CUSTOMREQUEST<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'PUT'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_SSL_VERIFYPEER<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_POSTFIELDS<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$json<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$result&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">curl_exec<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$httpCode&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">curl_getinfo<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLINFO_HTTP_CODE<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_close<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;store&nbsp;the&nbsp;status&nbsp;message&nbsp;based&nbsp;on&nbsp;response&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if&nbsp;(<\/span><span style=\"color: #0000BB\">$httpCode&nbsp;<\/span><span style=\"color: #007700\">==&nbsp;<\/span><span style=\"color: #0000BB\">200<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;p&nbsp;style=\"color:&nbsp;#34A853\"&gt;You have successfully subscribed to CodexWorld.&lt;\/p&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch&nbsp;(<\/span><span style=\"color: #0000BB\">$httpCode<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<\/span><span style=\"color: #0000BB\">214<\/span><span style=\"color: #007700\">:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$msg&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'You&nbsp;are&nbsp;already&nbsp;subscribed.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$msg&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'Some\u00a0problem\u00a0occurred,\u00a0please\u00a0try\u00a0again.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;p&nbsp;style=\"color:&nbsp;#EA4335\"&gt;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$msg<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #DD0000\">'&lt;\/p&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$_SESSION<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'msg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;p&nbsp;style=\"color:&nbsp;#EA4335\"&gt;Please&nbsp;enter&nbsp;valid&nbsp;email&nbsp;address.&lt;\/p&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;redirect&nbsp;to&nbsp;homepage<br \/><\/span><span style=\"color: #0000BB\">header<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'location:index.php'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<h2>Conclusion<\/h2>\n<p>This example code helps to add subscribers to mailChimp list from the website through custom subscription form. You can see the added subscriber&#8217;s list from MilChimp account. Login to your MailChimp account and go to the subscriber&#8217;s list, you&#8217;ll see the newly added subscribers in the list.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MailChimp is an email marketing service, helps to manage the subscribers of your website. MailChimp provides an easy way to integrate email signup form in your website and send the email newsletter to the subscriber. <\/p>\n","protected":false},"author":1,"featured_media":1737,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[51,14],"class_list":["post-1736","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-mailchimp","tag-php","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Add Subscriber to List using MailChimp API and PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add Subscriber to List using MailChimp API and PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-02T20:32:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-08-03T16:35:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Add Subscriber to List using MailChimp API and PHP\",\"datePublished\":\"2016-08-02T20:32:37+00:00\",\"dateModified\":\"2016-08-03T16:35:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/\"},\"wordCount\":588,\"commentCount\":22,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png\",\"keywords\":[\"MailChimp\",\"PHP\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/\",\"name\":\"Add Subscriber to List using MailChimp API and PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png\",\"datePublished\":\"2016-08-02T20:32:37+00:00\",\"dateModified\":\"2016-08-03T16:35:50+00:00\",\"description\":\"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"add-subscriber-to-list-using-mailchimp-api-php-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/add-subscriber-to-list-mailchimp-api-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add Subscriber to List using MailChimp API and PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add Subscriber to List using MailChimp API and PHP - CodexWorld","description":"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/","og_locale":"en_US","og_type":"article","og_title":"Add Subscriber to List using MailChimp API and PHP - CodexWorld","og_description":"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.","og_url":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-08-02T20:32:37+00:00","article_modified_time":"2016-08-03T16:35:50+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Add Subscriber to List using MailChimp API and PHP","datePublished":"2016-08-02T20:32:37+00:00","dateModified":"2016-08-03T16:35:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/"},"wordCount":588,"commentCount":22,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","keywords":["MailChimp","PHP"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/","url":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/","name":"Add Subscriber to List using MailChimp API and PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","datePublished":"2016-08-02T20:32:37+00:00","dateModified":"2016-08-03T16:35:50+00:00","description":"Custom Newsletter Subscription Form Integration with MailChimp \u2013 Example script to Add subscriber to list using MailChimp API and PHP from the website.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","width":1366,"height":768,"caption":"add-subscriber-to-list-using-mailchimp-api-php-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/add-subscriber-to-list-mailchimp-api-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Add Subscriber to List using MailChimp API and PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/add-subscriber-to-list-using-mailchimp-api-php-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-s0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1736"}],"version-history":[{"count":6,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1736\/revisions"}],"predecessor-version":[{"id":1750,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1736\/revisions\/1750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/1737"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}