| <?php |
| |
| $user = isset($_GET['ApiDID']) ? htmlspecialchars($_GET['ApiDID']) : ''; |
| $pass = isset($_GET['password']) ? htmlspecialchars($_GET['password']) : ''; |
| $realDID = isset($_GET['ApiRealDID']) ? htmlspecialchars($_GET['ApiRealDID']) : ''; |
| $callId = isset($_GET['ApiCallId']) ? htmlspecialchars($_GET['ApiCallId']) : ''; |
| $lang = isset($_GET['lang']) ? htmlspecialchars($_GET['lang']) : ''; |
| $number = isset($_GET['number']) ? htmlspecialchars($_GET['number']) : ''; |
| $goto = isset($_GET['goto']) ? htmlspecialchars($_GET['goto']) : ''; |
| $callingPhone = isset($_GET['ApiPhone']) ? htmlspecialchars($_GET['ApiPhone']) : ''; |
| |
| if (empty($user) || empty($pass) || empty($realDID) || empty($callId) || empty($lang) || empty($number)) { |
| die("id_list_message=t-חלק מהפרמטרים חסרים או לא תקינים"); |
| } |
| |
| |
| if ($realDID == $number) { |
| $idValue = ""; |
| $linkCalls = "https://www.call2all.co.il/ym/api/GetIncomingCalls?token={$user}:{$pass}"; |
| $responseCalls = file_get_contents($linkCalls); |
| |
| $httpStatusCalls = $http_response_header[0]; |
| if (strpos($httpStatusCalls, '200 OK') !== false) { |
| $responseCallsData = json_decode($responseCalls, true); |
| |
| if ($responseCallsData !== null) { |
| if (isset($responseCallsData['responseStatus']) && $responseCallsData['responseStatus'] === 'OK') { |
| if (isset($responseCallsData['calls']) && is_array($responseCallsData['calls'])) { |
| foreach ($responseCallsData['calls'] as $call) { |
| if (isset($call['callerIdNum']) && $call['callerIdNum'] === $callingPhone) { |
| $idValue = isset($call['id']) ? $call['id'] : null; |
| break; |
| } |
| } |
| } else { |
| die("id_list_message=t-שגיאה 1&id_list_message=g-/{$goto}"); |
| } |
| } else { |
| die("id_list_message=t-שגיאה 2&id_list_message=g-/{$goto}"); |
| } |
| } else { |
| die("id_list_message=t-שגיאה 3&id_list_message=g-/{$goto}"); |
| } |
| } else { |
| die("id_list_message=t-שגיאה 4&id_list_message=g-/{$goto}"); |
| } |
| |
| |
| $link = "https://www.call2all.co.il/ym/api/CallAction?token={$user}:{$pass}&ids={$idValue}&action=set:Clanguage={$lang}"; |
| |
| $response = file_get_contents($link); |
| |
| $httpStatus = $http_response_header[0]; |
| if (strpos($httpStatus, '200 OK') !== false) { |
| $responseData = json_decode($response, true); |
| |
| if ($responseData !== null) { |
| if (isset($responseData['responseStatus']) && $responseData['responseStatus'] === 'OK') { |
| echo "id_list_message=g-/{$goto}"; |
| } else { |
| echo "id_list_message=t-שגיאה&id_list_message=g-/{$goto}"; |
| } |
| } else { |
| echo "id_list_message=t-שגיאה בשינוי השפה הסטטוס ריק&id_list_message=g-/{$goto}"; |
| } |
| } else { |
| echo "id_list_message=t-שגיאה בגישה לשרת השפה&id_list_message=g-/{$goto}"; |
| } |
| } |
| |
| ?> |