Subscribe via URL

Dmitriy K

Hi! Any body know the way to add subscriber to list by simple URL request with name and email variables?

I need add my customers to list in background mode after they are purchase something. But in my shop i cant use API, only URL requests
I make and test a simple solution for all, working good.

Create file subscribemagic.php in root directory of MailWizz script with next code:

$hostname = ""; //add you domain here
$email = $_GET['email'];
$name = $_GET['name'];
$list_id = $_GET['list_id'];
$fp = fsockopen("$hostname", 80, $errno, $errstr, 10);
$out = "POST /index.php/lists/$list_id/subscribe HTTP/1.1\n";
$out .= "Host: $hostname\n";
$out .= "Referer: $hostname/\n";
$out .= "User-Agent: Opera\n";
$out .= "Content-Type: application/x-www-form-urlencoded\n";
$out .= "Content-Length: ".strlen($data)."\n\n";
$out .= $data."\n\n";
fputs($fp, $out);

URL for subscribe:

What you set in NAME_VARIABLE and EMAIL_VARIABLE depends from your shop-script(in my case this is %name% and %email%

P.S. Dont forget set file owner to www-root and rights to 644
Last edited: