0
<?php

    if(isset($_POST['ccode']) && isset($_POST['mobile'])){

    // Authorisation details.
    $username = "stravin123@gmail.com";
    $hash = "eb88119d3e9cdc20634c62f6493644ff94dec1b60597f68459becfb7ae0a7e96";

    // Config variables. Consult http://api.txtlocal.com/docs for more info.
    $test = "0";

    // Data for text message. This is the text message data.
    $sender = "Visitor Management Team"; // This is who the message appears to be from.
    $numbers = $_POST ['ccode'].$_POST['mobile']; // A single number or a comma-seperated list of numbers
    $message = $_POST['msg'];
    // 612 chars or less
    // A single number or a comma-seperated list of numbers
    $message = urlencode($message);
    $data = "username=".$username."&hash=".$hash."&message=".$message."&sender=".$sender."&numbers=".$numbers."&test=".$test;
    $ch = curl_init('http://api.txtlocal.com/send/?');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch); // This is the result from the API
    if($result ==true){
        echo "Message has been sent";
    curl_close($ch);

    }
?>

This is my php code. Whenever I try to access it, it keep showing HTTP ERROR 500. I am currently using hostinger. Please help. Thanks in advance

aynber
  • 22,380
  • 8
  • 50
  • 63
stravin wee
  • 35
  • 1
  • 4

0 Answers0