This is my index.html (form):
<div class="body">
<form method="post" action="index.php">
<div id="form">
<div class="formInput">
<label>To:
<input type="text" name="to" id="to" />
</label>
</div>
<div class="formInput">
<label>From:
<input type="text" name="from" id="from" />
</label>
</div>
<div class="formInput">
<label>Message:
<input type="text" name="message" id="message" />
</label>
</div>
<input type="submit" value="Submit" />
<input type="reset" value="Clear Form" />
</div>
</form>
And this is the index.php that handles the data:
<?php
$url = 'https://domainname.com/dashboard/api';
$r = new HttpRequest($url, HttpRequest::METH_POST);
$r->addQueryData(array('to' => $_POST['to'],
'from' => $_POST['from'],
'email' => $email,
'api_secret' => $api_secret));
try {
$r->send();
if ($r->getResponseCode() == 200) {
echo $r->getResponseBody();
}
} catch (HttpException $ex) {
echo $ex;
}
?>
Everytime i sumbit to the form i get an error: "PHP Fatal error: Class 'HttpRequest' not found" I have no idea how to resolve this since im running this on my namecheap web server.. A few people suggested i use cURL but i absolutely have no idea how.. I spent the past 3 hours trying to understand and i made zero progress.
Note:This how the http request should look like, i don't even know if i'm doing it correctly...
https://domainname.com/dashboard/api
?to={PHONE NUMBER}&from={SENDER ID}&message={TEXT}
&email={YOUR EMAIL}&api_secret={API SECRET}