Skip to content

Commit 29b4a7d

Browse files
committed
Improves docs
1 parent e49aaf0 commit 29b4a7d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,30 @@ print_r($result);
5050
Subscribe someone to a list (with a `post` to the `list/{listID}/members` method):
5151

5252
```php
53-
$result = $MailChimp->post('lists/b1234346/members', [
54-
'email_address' => 'davy@example.com',
55-
'status' => 'subscribed',
53+
$list_id = 'b1234346';
54+
$result = $MailChimp->post("lists/$list_id/members", [
55+
'email_address' => 'davy@example.com',
56+
'status' => 'subscribed',
5657
]);
5758
print_r($result);
5859
```
5960

60-
Update a list member with more information (using `put` to update):
61+
Update a list member with more information (using `patch` to update):
6162

6263
```php
63-
$result = $MailChimp->put('lists/b1234346/members/c67894321', [
64-
'merge_fields' => ['FNAME'=>'Davy', 'LNAME'=>'Jones'],
65-
'interests' => ['2s3a384h' => true],
64+
$subscriber_hash = $MailChimp->subscriberHash('davy@example.com');
65+
$result = $MailChimp->patch("lists/$list_id/members/$subscriber_hash", [
66+
'merge_fields' => ['FNAME'=>'Davy', 'LNAME'=>'Jones'],
67+
'interests' => ['2s3a384h' => true],
6668
]);
6769
print_r($result);
6870
```
6971

7072
Remove a list member using the `delete` method:
7173

7274
```php
73-
$MailChimp->delete('lists/b1234346/members/c67894321');
75+
$subscriber_hash = $MailChimp->subscriberHash('davy@example.com');
76+
$MailChimp->delete("lists/$list_id/members/$subscriber_hash");
7477
```
7578

7679
Troubleshooting

0 commit comments

Comments
 (0)