I have some data I want to sent as a HTTP POST request to a specific URL. I have googled and read for hours but I am stuck on writing the actually code.
I can created the complete URL I need and if I echo out the below sms_url variable and manually paste it into the browser address bar, the sms is sent successfully. My question is how do I make PHP do this automatically after a button click? 
    <?php
    $customer = '4512121212';
    //Create variable $sms_url to send sms to customer
    // The neccesary variables
    $sms_message = ("this is a test");
    $sms_url = "http://www.theurl.com/sms/";
    $sms_url .= "?message=" . urlencode($sms_message); //messages
    $sms_url .= "&recipient=$customer"; // Recipient
    $sms_url .= "&username=x"; // Username
    $sms_url .= "&password=x"; // Password
    $sms_url .= "&from=" . urlencode("company name"); // Sendername
    $sms_url .= "&utf8=1"; //UTF8 encoded
    echo $sms_url. "<br>";
now what??
    ?>
UPDATE and EDIT
I tested with curl but it is not working?
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $sms_url);
$content = curl_exec($ch);
var_dump($content);
?>
Any suggestions on what could be wrong?
UPDATE AND SOLVED
The below code works.
$curl = curl_init($sms_url);
$errmsg  = curl_error( $curl );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);  
?>
 
    