-1
我想檢查一個用戶輸入的電子郵件地址是否已經在用戶列表中。Mailchimp Api訂閱者通過php檢查
這是我到目前爲止已經試過:
<?php
$apikey = 'apikey';
$list_id = 'listid';
$chunk_size = 4096; //in bytes
$url = 'http://us14.api.mailchimp.com/export/1.0/list?apikey='.$apikey.'&id='.$list_id;
/** a more robust client can be built using fsockopen **/
$handle = @fopen($url,'r');
if (!$handle) {
echo "failed to access url\n";
} else {
$i = 0;
$header = array();
while (!feof($handle)) {
$buffer = fgets($handle, $chunk_size);
if (trim($buffer)!=''){
$obj = json_decode($buffer);
if ($i==0){
//store the header row
$header = $obj;
} else {
//echo, write to a file, queue a job, etc.
echo $obj[0];
}
$i++;
}
}
fclose($handle);
}
?>
這將返回所有電子郵件用戶。我試圖縮小到用戶輸入的特定電子郵件,但我卡住了,不知道該怎麼做?