In my development enviroment, i enable CURL .when i deployed the code via wamp server, everything works and i was able to send sms when connected to internet.
when i hosted the code on my linux web hosting account, it displays error shown below and thus cannot send sms.
below is the error showned
Not Acceptable
An appropriate representation of the requested resource /components/com_spc/smsapi.php could not be found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/1.0.1e-fips DAV/2 mod_bwlimited/1.4 Server at www.examplesms.com Port 80
below is the code.
Code:
<?php
if(isset($_POST['submit'])){
$data = array(
'username' => $_POST['username'],
'password' => $_POST['password'],
'sender' => $_POST['sender'],
'recipient' => $_POST['recipient'],
'message' => $_POST['message']
);
// Send the POST request with cURL
$ch = curl_init('http://www.examplesms.com/components/com_spc/smsapi.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch); //This is the result from Textlocal
if(curl_exec($ch) === false) {
echo '<font color=red size=4><b>Message sending failed' . '</b></font><br />';
} else {
echo '<font color=orange size=4><b>Message sent successfully' . '</b></font><br />';
echo 'Total number of bytes downloaded: ' . curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD) . '<br />';
echo 'Total size of all headers received: ' . curl_getinfo($ch,CURLINFO_HEADER_SIZE) . '<br />';
}
curl_close($ch);
//var_dump($result);
print($result);
} else {
?>
<form method="post" style="margin: 5px; padding: 5px;">
<table width="100%" border="0" cellspacing="5px" cellpadding="3px">
<tr>
<td><input name="username" type="hidden" id="username" value="" size="50" style="width: 400px;" /></td>
</tr>
<tr>
<td><input name="password" type="hidden" id="password" value="" size="50" style="width: 400px;" /></td>
</tr>
<tr>
<td><input name="sender" type="hidden" id="sender" size="50" style="width: 400px;" value=""/></td>
</tr>
<tr>
<td>Reciever</td>
<td>
<input name="recipient" type="text" id="recipient" size="50" style="width: 400px;" value=""/>
</td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="message" rows="4" cols="90" id="message" style="width: 400px; height: 120px;"></textarea></td>
</tr>
<tr>
<td>
<td><input type="submit" name="submit" id="add_subcat" value="Send Now!" class="btn btn-info btn-small"></input> <input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</form>
<?php
}
?>
Bookmarks