Created
May 17, 2017 05:50
-
-
Save ermst4r/37e492deb321f451c041e4d570c2f20e to your computer and use it in GitHub Desktop.
Engine lead script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php ini_set('display_errors', 0); | |
| header('Content-Type: application/json'); | |
| /** | |
| * @Author: Erwin Nandpersad | |
| * Class Engine | |
| */ | |
| class Engine | |
| { | |
| /** | |
| * @var string | |
| */ | |
| protected $engine_username = ''; | |
| /** | |
| * @var string | |
| */ | |
| protected $engine_password = ''; | |
| /** | |
| * Engine url | |
| * @var string | |
| */ | |
| protected $engine_url = 'https://hellospecial.e-ngine.nl/soap/ENgineSoap.php'; | |
| /** | |
| * @return string | |
| */ | |
| public function getEngineUsername() | |
| { | |
| return $this->engine_username; | |
| } | |
| /** | |
| * @param string $engine_username | |
| */ | |
| public function setEngineUsername($engine_username) | |
| { | |
| $this->engine_username = $engine_username; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getEnginePassword() | |
| { | |
| return $this->engine_password; | |
| } | |
| /** | |
| * @param string $engine_password | |
| */ | |
| public function setEnginePassword($engine_password) | |
| { | |
| $this->engine_password = $engine_password; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getEngineUrl() | |
| { | |
| return $this->engine_url; | |
| } | |
| /** | |
| * @param string $engine_url | |
| */ | |
| public function setEngineUrl($engine_url) | |
| { | |
| $this->engine_url = $engine_url; | |
| } | |
| /** | |
| * @param $email | |
| * @param string $type | |
| * @return bool | |
| */ | |
| public function subscribeNewsLetter($data,$type='subscribe') | |
| { | |
| ini_set('soap.wsdl_cache_enabled', '0'); | |
| try { | |
| $wsdl = $this->engine_url; | |
| $client = new \SoapClient( | |
| $wsdl, | |
| array( | |
| 'login' => $this->engine_username, | |
| 'password' => $this->engine_password, | |
| 'trace' => 1 | |
| ) | |
| ); | |
| switch($type) { | |
| case 'subscribe': | |
| return $client->Subscriber_set($data); | |
| break; | |
| case 'unsubscribe': | |
| return $client->Subscriber_unsubscribe($data['email']); | |
| break; | |
| } | |
| } catch (\SoapFault $exception) { | |
| return $exception->getMessage(); | |
| } | |
| } | |
| } | |
| $Engine = new Engine(); | |
| $type = (isset($_GET['type']) ? $_GET['type'] : null); | |
| $hash = (isset($_GET['hash']) ? $_GET['hash'] : null); | |
| $fee =0.00; | |
| if($hash != 'your_hash') { | |
| echo json_encode(['status'=>'fail','msg'=>'invalid hash']); | |
| exit; | |
| } | |
| $data = array ( | |
| 'email' => (isset($_GET['email']) ? $_GET['email'] : ''), | |
| 'voornaam' => (isset($_GET['firstname']) ? $_GET['firstname'] : ''), | |
| 'tussenvoegsel' => (isset($_GET['initials']) ? $_GET['initials'] : ''), | |
| 'achternaam' => (isset($_GET['lastname']) ? $_GET['lastname'] : ''), | |
| 'geslacht' => (isset($_GET['email']) ? $_GET['email'] : ''), // m v | |
| 'geboortedatum' => (isset($_GET['dob']) ? $_GET['dob'] : ''), // dd-mm-yy | |
| 'actieid' => '4', | |
| 'campaign' => 'campaign', | |
| 'source' => 'source', | |
| 'fee' => $fee, | |
| ); | |
| // call like this: https://www.hellospecial.com/lead-leaders.php?email=xx@xx.com&type=sponsor&gender=m&firstname=xx&initials=Van&lastname=xx&dob=31-07-1988&hash=your_hash | |
| ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment