mailchimp/APIv3-examples

PHP

TheCosmonaut opened this issue · 7 comments

I'd love to see examples for PHP as well. All the PHP wrappers I've found are for v2.

bump, me too

👍 Same here. When will we see v3 PHP wrappers. I found this..

https://github.com/drewm/mailchimp-api/tree/api-v3

Hey folks -- no ETA on wrappers or examples at this time.

For our own internal access to APIv3, we only put a very thin layer around either Guzzle or PHP Requests and haven't really found a great need for a full-fledged library yet, and the engineers writing that code have found the Python examples sufficient to get started.

We will definitely have both wrappers and examples eventually, but there are a lot of things considerably higher on the priority list right now.

For a basic PHP/cURL auth and respond request you can use this code below.

$username = "tcgumus"; //it can be anything
$password = "API KEY";
// create curl resource 
$ch = curl_init(); 
// set url 
curl_setopt($ch, CURLOPT_URL, "http://us10.api.mailchimp.com/3.0/"); //make sure your dc is correct
//return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
// $output contains the output string 
$output = curl_exec($ch); 
// close curl resource to free up system resources 
curl_close($ch);   
print_r($output);

I have tried what @tcgumus has added above however I get no response at all . I have been attempting to follow MailChimp Docs however I don't know how to execute any of the stuff in the PHP. Any suggestions are welcome, thanks

Hi, @hugoreaction -- this is not a good place to get API support. You'll want to reach out to apihelp at mailchimp dot com if you're having trouble.

I wrote a small example and will add functionality to it and make it public if anyone will approve the pull request: #25