What's new

Need help about sending multiple contacts in php

Clay_dropdead

Honorary Poster
Joined
Feb 28, 2017
Posts
332
Reaction
206
Points
229
Hi sa mga php developers dyan magpapatulong po sana ako about this codes papano kaya makapag send ng dalawa o higit pang contacts sa code ko

<?php

//##########################################################################
// ITEXMO SEND SMS API - PHP - CURL-LESS METHOD
// Visit You do not have permission to view the full content of this post. Log in or register now. for more info about this API
//##########################################################################
function itexmo($number,$message,$apicode){
$url = 'You do not have permission to view the full content of this post. Log in or register now.
$itexmo = array('1' => $number, '2' => $message, '3' => $apicode);
$param = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($itexmo),
),
);
$context = stream_context_create($param);
return file_get_contents($url, false, $context);}
//##########################################################################


if($_POST){
$number = $_POST['number'];
$name = $_POST['name'];
$msg = $_POST['msg'];
$api = "TR-ACEHA784027_8U8LT";
$text = $name. "" .$msg;

echo $text;
if(!empty($_POST['name']) &&($_POST['number'])&& ($_POST['msg'])){
$result = itexmo($number,$text,$api);
}
if ($result == ""){
echo "iTexMo: No response from server!!!
Please check the METHOD used (CURL or CURL-LESS). If you are using CURL then try CURL-LESS and vice versa.
Please CONTACT US for help. ";
}else if ($result == 0){
echo "Message Sent!";
}
else{
echo "Error Num ". $result . " was encountered!";
}

}

?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>SMSModule</title>

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="You do not have permission to view the full content of this post. Log in or register now."></script>
<script src="You do not have permission to view the full content of this post. Log in or register now."></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<form method="POST" action="index.php">
<div class="form-group">
<label for="name">Your Name</label>
<input type="text" maxlength="10" class="form-control" id="name" placeholder="Name" name="name" required>
</div>
<div class="form-group">
<label for="number">Recipient's Mobile Number </label>
<input type="text" class="form-control" id="number" placeholder="Mobile Number" name="number" required>
</div>
<div class="form-group">
<label for="msg">Your Message</label>
<textarea class="form-control" rows="3" name="msg" placeholder="Message Here" onkeyup="countChar(this)" required></textarea>
</div>
<p class="text-right" id="charNum">85</p>
<button type="submit" class="btn btn-success">Send</button>
</form>
</div>
</div>
</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="You do not have permission to view the full content of this post. Log in or register now."></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
function countChar(val){
var len = val.value.length;
if(len >=85){
val.value = val.value.substring(0,85);

}else{
$('#charNum').text(85-len);
};
}
</script>
</body>
</html>
 
Same problem now.
Anu solution po?
HTML:
<?php

$num = $_POST['num'];
$mess = $_POST['mess'];
print_r($num);
$count = count($num);
for($i=0; $i<$count; $i++){
    $postRequest = array(
        '1' => $num[$i],
        '2' => $mess[$i],
        '3' => 'CODE MO D2',
        'passwd' => 'PASS NG CODE MO D2'
    );

    $cURLConnection = curl_init('https://www.itexmo.com/php_api/api.php');
    curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
    curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

    $apiResponse = curl_exec($cURLConnection);
    curl_close($cURLConnection);
    if($apiResponse == "0"){
        echo "sending message to ".$num[$i]." success<br/>";
    }else{
echo "sending message to ".$num[$i]." failed<br/>";
}
}

?>
<form method="POST">
number
<input type="text" name="num[]">
mess
<input type="text" name="mess[]"><br>
number
<input type="text" name="num[]">
mess
<input type="text" name="mess[]"><br>
number
<input type="text" name="num[]">
mess
<input type="text" name="mess[]"><br>
number
<input type="text" name="num[]">
mess
<input type="text" name="mess[]"><br>
number
<input type="text" name="num[]">
mess
<input type="text" name="mess[]"><br>
<input type="submit">
</form>

yan na pinagisipan ko talaga yan happy coding wag ka na magpakahirap tanong mo nalang ako pag may prob
 
Last edited:
Gsto ko sana lods in one click and in one textbox or textarea where in dun ko ilalagay ung multiple numbers masesend agad sa mga recipients.
 
Gsto ko sana lods in one click and in one textbox or textarea where in dun ko ilalagay ung multiple numbers masesend agad sa mga recipients.
 
[XX='Dkxyle, c: 401340, m: 1333513'][/XX] cge gawa ko mamaya maaga pa kasi.

Gusto mo marami sendan pero isa lang message? O per number different message
 
Gsto ko sana lods in one click and in one textbox or textarea where in dun ko ilalagay ung multiple numbers masesend agad sa mga recipients.
HTML:
<?php

$num = $_POST['num'];
$mess = $_POST['mess'];
$num = explode(" ",$num);
$mess = explode("\n",$mess);
$count = count($num);
for($i=0; $i<$count; $i++){
    $postRequest = array(
        '1' => $num[$i],
        '2' => $mess[$i],
        '3' => 'CODE MO D2',
        'passwd' => 'PASS NG CODE MO D2'
    );

    $cURLConnection = curl_init('https://www.itexmo.com/php_api/api.php');
    curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
    curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);

    $apiResponse = curl_exec($cURLConnection);
    curl_close($cURLConnection);
    if($apiResponse == "0"){
        echo "sending message to ".$num[$i]." success<br/>";
    }else{
echo "sending message to ".$num[$i]." failed<br/>";
}
}

?>
<form method="POST">
number
<input type="text" name="num">
mess
<textarea type="text" name="mess"></textarea>

<br>

<input type="submit">
</form>

pag input mo ng number ang format ay number (one space) number

Sa message naman ang format
message (enter/or new line)
message
 
Kung isa lang gusto mo message pero madi sendan remove mo lang yung line 6 yung $mess = explode blabla bla

And line 11 na $mess[$i] to $mess

Yun lang sana makatulong
 
paps baka matulungan nyo po ako.
Gumawa ako ng 2 tables ung isa may foreign key. Sa applicant table meron id, address_id(foreign key), fname and lastname tas sa second table which the address table ung laman nya ay address_id barangay, city and province.
Ang tanong ko po panu po kaya ako magiinsert ng data dun sa row na may foreign key using php?
 
paps baka matulungan nyo po ako.
Gumawa ako ng 2 tables ung isa may foreign key. Sa applicant table meron id, address_id(foreign key), fname and lastname tas sa second table which the address table ung laman nya ay address_id barangay, city and province.
Ang tanong ko po panu po kaya ako magiinsert ng data dun sa row na may foreign key using php?
Ahhh gets ko na ganito

Yan pah insert
PHP:
<?php

$sql="INSERT INTO table_name (foreignkey, fname, lname)
VALUES ('$foreignkey', '$fname', '$lname')";

if (mysqli_query($conn, $sql)) {
  echo "Successful";
} else {
  echo "Error: " .mysqli_error($conn);
}


?>

Pag papalitan mo ganito

<?php

$sql="UPDATE table_name
SET foreignkey = '$fkey'
WHERE id = $id;

if (mysqli_query($conn, $sql)) {
echo "success";
} else {
echo "Error: " . mysqli_error($conn);
}


?>
 
Master na try kna pala ung codes about dun sa sms gumana po sya ang galing nyo ang kaso po bawat number dapat may message kapag po kasi walang laman ung isa error po.
Ang gsto ko po sana mangyari is one message lng into multiple numbers.
 

Similar threads

Back
Top