From ab8c6868096bb5c200ffd08f6aa9a98e9cca3c46 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Thu, 31 Jul 2014 19:51:28 +0200 Subject: [PATCH] Re-wrote entire cURL-part and the params part - Now using https instead of http - Changed from GET to POST - Parameters is now in an array instead of a variable - Using http_build_query instead of preg_replace to URLify --- class.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/class.php b/class.php index d51e90c..3892b94 100644 --- a/class.php +++ b/class.php @@ -56,12 +56,23 @@ class Cellsynt $this->phoneNr = $phoneNr; $this->expiry = $expiry; - $url = "http://se-1.cellsynt.net/sms.php?username=$this->username&password=$this->password&destination=$this->phoneNr&originatortype=$this->origType&originator=$this->originator&allowconcat=$this->concat&charset=$this->charset&type=$this->type&expiry=$this->expiry&text=$this->msg"; + $params = array ("username" => "$this->username", + "password" => "$this->password", + "destination" => "$this->phoneNr", + "originatortype" => "$this->origType", + "originator" => "$this->originator", + "allowconcat" => "$this->concat", + "charset" => "$this->charset", + "type" => "$this->type", + "expiry" => "$this->expiry", + "text" => "$this->msg"); - $urlFormatted = preg_replace("/\s/", "%20", $url); - $ch = curl_init($urlFormatted); + $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_URL, "https://se-1.cellsynt.net/sms.php"); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, (http_build_query($params))); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $status = curl_exec($ch); curl_close($ch); return $status;