用于Sendy API的PHP Foreach关联数组循环

I always struggle with loops and in particular associative arrays is still new to me and trying to get past it. I am trying to setup a form to insert multiple emails at once into our sendy email list through the use of their api. I am successful in inserting the first email into the list, but the remaining emails get lost. Your help is greatly appreciated!

PHP Below:

<?php 
require('sendyLibrary.php');
$sendy = new SendyLibrary('3');
$email = $_POST['email'];

//$textareaContents = str_replace("", ',', $email);
$multipleEmails = explode("", $email);
foreach($multipleEmails as $key => $finalEmail) {
    $sendy->subscribe(array(
        'email' => $finalEmail
    ));
    echo 'email: ' . $finalEmail .'<br/>';
}?>

Response from POST method:

email   sam@testing.com samg@testing.com samgo@testing.com samgol@testing.com samgolu@testing.com

Source from POST method:

email=sam%40testing.com%0D%0Asamg%40testing.com%0D%0Asamgo%40testing.com%0D%0Asamgol%40testing.com%0D%0Asamgolu%40testing.com

Thank you for your help!

There is actually a inbetween all of the emails. I assume the subscribe method is throwing them out because when you explode the array on then you will have new lines on all the remaining emails. Looking like:

array("email1@testing.com", 
      "
email2@testing.com", 
      "
email3@testing.com");

You should explode the tring on like so:

$multipleEmails = explode("
", $email);

The other option would be to fix the code that sends the POST to provide a better delimited string..