public function proximus_optin() { /* Settings */ $user = '******'; $password = '******'; $salt = 'ea219dae-bb66-4d48-9869-b1e3515044a1'; $msisdn = $this->mobile_phone_number; $email = $this->email; $zipcode = $this->zip_code; $gender = $this->gender == 'Male' ? 'M' : 'F'; $carrier = ' '; $locale = $this->locale; $keyword = $this->keyword; $category = urlencode(implode($this->products, ', ')); $postParams = array('username' => $user, 'token' => $token, 'msisdn' => $msisdn, 'email' => $email, 'zipcode' => $zipcode, 'carrier' => $carrier, 'gender' => $gender, 'category' => $category, 'locale' => $locale, 'keyword' => $keyword); try { /* Create new ProximusApiHelper that calls api webinteraction with $postParams */ /* Response is returned in json */ $PAH = new ProximusApiHelper($user, $salt, $password, "webinteraction", $postParams); $data = $PAH->POST(); //Send post request save data in data /* For XML response use */ /* $PAH = new ProximusApiHelper($user, $salt, $password); $data = $PAH->POST("webinteraction", $postParams, "application/xml"); */ } catch (Exception $e) { error_log('proximus_optin exception ' . $e->message); } }
} if ($params != NULL) { $this->setParams($params); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->getAPIURL("http://192.168.1.211:8080/ProximusTomorrow-war/api")); curl_setopt($ch, CURLOPT_POST, count($this->getPOSTFields())); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->getPOSTFields())); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . $accept)); $raw_result = curl_exec($ch); curl_close($ch); return $raw_result; } } $t = new ProximusApiHelper("*****@*****.**", "ea219dae-bb66-4d48-9869-b1e3515044a1", "52d81ead-f70c-4e60-ac1e-6fb6f8926eec"); if ($_SERVER["REQUEST_METHOD"] == "GET") { $raw_result = $t->POST("categorylist"); $result = json_decode($raw_result); if ($result->status != "OK") { //echo $result->status_message; } else { $rows = 0; echo "<form method=\"POST\" action=\"proximus.php\">\nPhone: <input name=\"msisdn\" value=\"14042776402\" /><br/> \nEmail Address: <input name=\"email\" value=\"ejohansson@proximusmobility.com\"><br/>\nMobile Carrier: <input name=\"carrier\" value=\"AT&T\" ><br/>\n\tZipCode: <input name=\"zipcode\" value=\"30309\" ><br/>\n\tGender: <select name=\"gender\" size=\"1\">\n\t\t<option value=\"M\" selected>Male</option>\n\t\t<option value=\"F\">Female</option></select><br/>\n\n<table><tr>"; foreach ($result->category as $index => $category) { if ($rows % 3 == 0) { echo "</tr><tr>"; } printf("<td><input id=\"%s\" type=\"checkbox\" name=\"categories[]\" value=\"%s\" /><label for=\"%s\">%s</label><td>", $category->id, $category->name, $category->id, $category->name); $rows++; }