How to add Spread API into my PHP project?
-
Enable SOAP extension module ,
Examine phpinfo,SOAP’s installation as the picture below:
If SOAP is under the status of “enable”, you need not to carry out these steps.
Operations of setting up SOAP under the circumstance of Windows are as follows.
-
Open the document of” php.ini” and find the panel point “extension=php_soap.dll”, then erase “;”in front of the panel point. If you can not find this panel point, please add this document.
-
Find the panel point ”extension_dir=” in the document of “php.ini”, and open the corresponding contents document to check whether there is a document of “soap.dll” or not.
-
If you cannot find the document of “soap.dll”, you should download “soap.dll” and save it in the document. Then you should restart “web server” to check the installation of “SOAP” in “ phpinfo” again.
-
Example:
Login your Spread Account -> My Account -> API -> API Url to get your API url.
$APIUrl = "http://service.rspread.com/Service.asmx"
$client = new SoapClient($APIUrl."?WSDL");
$arrayPara = array('loginEmail'=>'test@reasonables.com','password'=>'your api key','subscriberEmail'=>'customer11@reasonables.com', 'subscription'=>'SeedList','optInType'=>'Off');
$result = $client->addSubscriberByEmail($arrayPara);