I am attempting to get an access token using my PayPal API credentials, here is the code
<?php
class PayPalAPI
{
private $sandbox = true;
private $url;
private $clientid;
private $secret;
private $data;
public function __construct($sbox = true)
{
$this->url['sandbox'] = "https://api.sandbox.paypal.com";
$this->url['live'] = "https://api.paypal.com";
$this->clientid['sandbox'] = "secretsandboxclientid";
$this->clientid['live'] = "secretliveclientid";
$this->secret['sandbox'] = "secretsandboxkey";
$this->secret['live'] = "secretlivekey";
$this->sandbox = $sbox;
if ($this->sandbox == true)
{
$this->url['use'] = $this->url['sandbox'];
$this->clientid['use'] = $this->clientid['sandbox'];
$this->secret['use'] = $this->secret['sandbox'];
}
else
{
$this->url['use'] = $this->url['live'];
$this->clientid['use'] = $this->clientid['live'];
$this->secret['use'] = $this->secret['live'];
}
}
public function getAccessToken()
{
$ch = curl_init($this->url['use'] + "/v1/oauth2/token");
curl_setopt($ch, CURLOPT_ENCODING, "Accept: application/json");
curl_setopt($ch, CURLOPT_ENCODING, "Accept-Language: en_US");
curl_setopt($ch, CURLOPT_USERPWD, $this->clientid['use'] . ":" . $this->secret['use']);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}
$api = new PayPalAPI();
$token = $api->getAccessToken();
var_dump($token);
?>
But the response is not as expected, for some reason it is dumping the godaddy "This is the future of something cool"
Here is the link http://xlagmasterx.com/test.php
Why is this returning the page?
Related
I have an email campaign on Marketo to send emails using PHP. on my email template I have a token like, {{my.emailBody:default=Body}} I would like to replace the the token with my custom email content from my PHP code,
This is my code,
$sample = new SendSampleEmail();
$sample->id = 11111;
$sample->emailAddress = "myemail#example.com";
print_r($sample->postData());
class SendSampleEmail{
private $host = "https://AAA-AAA-121.mktorest.com";
private $clientId = "dxxxxxxxxxxxxxxxxxxxxx1";
private $clientSecret = "Sxxxxxxxxxxxxxxxxxxxxxxxxxxxxe";
public $id; //id of to delete
public $emailAddress;//email address to send to
public $textOnly;//boolean option to send text only version
public $leadId;// id of lead to impersonate
public function postData(){
$url = $this->host . "/rest/asset/v1/email/" . $this->id . "/sendSample.json?access_token=" . $this->getToken();
$requestBody = "&emailAddress=" . $this->emailAddress;
if (isset($this->textOnly)){
$requestBody .= "&textOnly=" . $this->textOnly;
}
if (isset($this->leadId)){
$requestBody .= "&leadId=" . $this->leadId;
}
//print_r($requestBody);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_getinfo($ch);
$response = curl_exec($ch);
return $response;
}
private function getToken(){
$ch = curl_init($this->host . "/identity/oauth/token?grant_type=client_credentials&client_id=" . $this->clientId . "&client_secret=" . $this->clientSecret);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('accept: application/json',));
$response = json_decode(curl_exec($ch));
curl_close($ch);
$token = $response->access_token;
return $token;
}
}
Using this code I can successfully trigger the emails, but how can I replace the token value {{my.emailBody:default=Body}} ?
I have the same problem which I tried to used Assets Tokens from the REST API: http://developers.marketo.com/rest-api/assets/tokens/
to modify token's values, but it is the only endpoint I cannot make it work. Please let me know if you could make it work.
However, I used the SOAP API to solve for this issue:
You create a Batch Campaign from Marketo inside a Marketo Program that contains the Token you want to modify and the email you want to send using that token.
The SOAP API will schedule the campaign to run (you can set the current time for immediate run), and you can set the value for the tokens:
public function schedule_campaign($program_name,$campaign_name,$token_name,$token_value)
{
$params = new stdClass();
$params->programName = $program_name;
$params->campaignName = $campaign_name;
$dtzObj = new DateTimeZone("America/New_York");
$dtObj = new DateTime('now', $dtzObj);
$params->campaignRunAt = $dtObj->format(DATE_W3C);
$token = new stdClass();
$token->name = "{{my.".$token_name."}}";
$token->value = $token_value;
$params->programTokenList = array("attrib" => $token);
$params = array("paramsScheduleCampaign" => $params);
$soapClient = new SoapClient(MARKETO_SOAP_ENDPOINT ."?WSDL", self::$auth_options);
try
{
$response = $soapClient->__soapCall('scheduleCampaign', $params, self::$auth_options, self::$auth_header);
return true;
}
catch(Exception $ex) {
return false;
}
}
UPDATE:
I've found the way to update/replace tokens using REST API:
public function create_token($folder_id,$name,$content,$folder_type = 'Program')
{
$folder_id = intval($folder_id);
$endpoint = 'rest/asset/v1/folder/'.$folder_id.'/tokens';
$url = $this->url . $endpoint . ".json?access_token=" . self::$token."&folderType=".$folder_type."&name=".$name."&type=". urlencode('rich text')."&value=".urlencode($content);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response);
}
Token replacement only works with the Request Campaign and Schedule Campaign APIs, you can't replace my tokens with the send sample email API.
Really new in Laravel and I still trying to learn it so please help me a bit here. There is one class which pull data from another site. The problem is that it is using fopen but in matter of server security this function is off so it must use curl.
const CACHE_KEY = 'rate';
public static function getRate() {
if (Cache::has(self::CACHE_KEY)) {
return Cache::get(self::CACHE_KEY);
}
$oneHourTimestamp = \Carbon\Carbon::now()->addHours(1);
$tenMinutesTimestamp = \Carbon\Carbon::now()->addMinutes(10);
$page = trim(file_get_contents('https://example.com/'));
$rates = json_decode($page, TRUE);
if (!$rates) {
Cache::put(self::CACHE_KEY, '-', $tenMinutesTimestamp);
return '-';
}
$Rate = #$rates['1']['2'];
if (!$Rate) {
Cache::put(self::CACHE_KEY, '-', $tenMinutesTimestamp);
return '-';
}
Cache::put(self::CACHE_KEY, $Rate, $oneHourTimestamp);
return $usdRate;
}
UPDATE:
Like this?
function get_curl_content($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
const CACHE_KEY = 'rate';
public static function getRate() {
if (Cache::has(self::CACHE_KEY)) {
return Cache::get(self::CACHE_KEY);
}
$oneHourTimestamp = \Carbon\Carbon::now()->addHours(1);
$tenMinutesTimestamp = \Carbon\Carbon::now()->addMinutes(10);
$result = $this->get_curl_content('https://example.com/');
$rates = json_decode($result, TRUE);
if (!$rates) {
Cache::put(self::CACHE_KEY, '-', $tenMinutesTimestamp);
return '-';
}
$Rate = #$rates['1']['2'];
if (!$Rate) {
Cache::put(self::CACHE_KEY, '-', $tenMinutesTimestamp);
return '-';
}
Cache::put(self::CACHE_KEY, $Rate, $oneHourTimestamp);
return $usdRate;
}
To get the contentos of a webpage with curl you can create this function and add it to your class:
function get_curl_content($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
And you can change
$page = trim(file_get_contents('https://example.com/'));
for:
$page = $this->get_curl_content('https://example.com/');
I am using this PHP Class for Instagram's API: https://github.com/cosenary/Instagram-PHP-API.
It works perfectly but I can't seem to access the rate limit information for each call I make.
Inside the class, this is the method that makes the call:
protected function _makeCall($function, $auth = false, $params = null, $method = 'GET') {
if (false === $auth) {
$authMethod = '?client_id=' . $this->getApiKey();
} else {
if (true === isset($this->_accesstoken)) {
$authMethod = '?access_token=' . $this->getAccessToken();
} else {
throw new \Exception("Error: _makeCall() | $function - This method requires an authenticated users access token.");
}
}
if (isset($params) && is_array($params)) {
$paramString = '&' . http_build_query($params);
} else {
$paramString = null;
}
$apiCall = self::API_URL . $function . $authMethod . (('GET' === $method) ? $paramString : null);
$headerData = array('Accept: application/json');
if (true === $this->_signedheader && 'GET' !== $method) {
$headerData[] = 'X-Insta-Forwarded-For: ' . $this->_signHeader();
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiCall);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerData);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ('POST' === $method) {
curl_setopt($ch, CURLOPT_POST, count($params));
curl_setopt($ch, CURLOPT_POSTFIELDS, ltrim($paramString, '&'));
} else if ('DELETE' === $method) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
}
$jsonData = curl_exec($ch);
if (false === $jsonData) {
throw new \Exception("Error: _makeCall() - cURL error: " . curl_error($ch));
}
curl_close($ch);
return json_decode($jsonData);
}
The information I need to access from Instagram's API is:
X-Ratelimit-Limit
X-Ratelimit-Remaining
(http://instagram.com/developer/limits/ for more information about Instagram's limits).
For obvious reasons I need the app I'm creating to "shut itself down" before the rate limit kicks in. By accessing the rate limit information I can achieve this.
I have found a Gist that should work with this class but I can't seem to get it to work: https://gist.github.com/cosenary/6af4cf4b509518169b88
Also this topic here on Stackoverflow seems to be fruitless:
Instagram API count limits using HTTP header
If anyone could help me out here that would be amazing!
Best regards,
Peter de Leeuw
I have modified the function _makeCall and it is as follows by adding first curl_setopt($ch, CURLOPT_HEADER, true); and calling the function processHeader() as cosenary suggested on this gist cosenary/ratelimit.php:
protected function _makeCall($function, $auth = false, $params = null, $method = 'GET') {
if (false === $auth) {
// if the call doesn't requires authentication
$authMethod = '?client_id=' . $this->getApiKey();
} else {
// if the call needs an authenticated user
if (true === isset($this->_accesstoken)) {
$authMethod = '?access_token=' . $this->getAccessToken();
} else {
throw new \Exception("Error: _makeCall() | $function - This method requires an authenticated users access token.");
}
}
if (isset($params) && is_array($params)) {
$paramString = '&' . http_build_query($params);
} else {
$paramString = null;
}
$apiCall = self::API_URL . $function . $authMethod . (('GET' === $method) ? $paramString : null);
// signed header of POST/DELETE requests
$headerData = array('Accept: application/json');
if (true === $this->_signedheader && 'GET' !== $method) {
$headerData[] = 'X-Insta-Forwarded-For: ' . $this->_signHeader();
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiCall);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerData);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ('POST' === $method) {
curl_setopt($ch, CURLOPT_POST, count($params));
curl_setopt($ch, CURLOPT_POSTFIELDS, ltrim($paramString, '&'));
} else if ('DELETE' === $method) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
}
$jsonData = curl_exec($ch);
// split header from JSON data
// and assign each to a variable
list($headerContent, $jsonData) = explode("\r\n\r\n", $jsonData, 2);
// convert header content into an array
$headers = $this->processHeaders($headerContent);
// get the 'X-Ratelimit-Remaining' header value
$ratelimitRemaining = $headers['X-Ratelimit-Remaining'];
$this->setHeaderLimit($ratelimitRemaining);
if (false === $jsonData) {
throw new \Exception("Error: _makeCall() - cURL error: " . curl_error($ch));
}
curl_close($ch);
return json_decode($jsonData);
}
the processHeader() method which processes the header and the set and get methods for the $rateLimitRemaining are as follows :
private function processHeaders($headerContent){
$headers = array();
foreach (explode("\r\n", $headerContent) as $i => $line) {
if($i===0){
$headers['http_code'] = $line;
}else{
list($key,$value) = explode(':', $line);
$headers[$key] = $value;
}
}
return $headers;
}
private function setHeaderLimit($HeaderLimit){
$this->HeaderLimit = $HeaderLimit;
}
public function getHeaderLimit(){
return $this->HeaderLimit;
}
You can access the X-Ratelimit-Remaining now from another class just by calling the getHeaderLimit()
*Don't forget to declare the public field HeaderLimit within the class where _makeCall() resides, which in this case is Instagram.php.
**I have tested this solution and it works perfectly.
Hope this helps you guys :)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I've been trying for some time now to use cURL to login to eBay.co.uk. The cookies are being set and the post data is being sent correctly however I am not sure that the cookie file is being read again or even set correctly for that matter since I'm getting a page from eBay that says I need to enable cookies in my browser.
Here is the cURL class I'm using:
class Curl {
private $ch;
private $cookie_path;
private $agent;
public function __construct($userId) {
$this->cookie_path = dirname(realpath(basename($_SERVER['PHP_SELF']))).'/cookies/' . $userId . '.txt';
$this->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
}
private function init() {
$this->ch = curl_init();
}
private function close() {
curl_close ($this->ch);
}
private function setOptions($submit_url) {
curl_setopt($this->ch, CURLOPT_URL, $submit_url);
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->agent);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie_path);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie_path);
}
public function curl_cookie_set($submit_url) {
$this->init();
$this->setOptions($submit_url);
$result = curl_exec ($this->ch);
$this->close();
return $result;
}
public function curl_post_request($referer, $submit_url, $data) {
$this->init();
$this->setOptions($submit_url);
$post = http_build_query($data);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($this->ch, CURLOPT_REFERER, $referer);
$result = curl_exec ($this->ch);
$this->close();
return $result;
}
public function curl_clean() {
// cleans and closes the curl connection
if (file_exists($this->cookie_path)) {
unlink($this->cookie_path);
}
if ($this->ch != '') {
curl_close ($this->ch);
}
}
}
Here is the test script, the login details are for a throwaway account, so feel free to test with them:
$curl = new Curl(md5(1)); //(md5($_SESSION['userId']));
$referer = 'http://ebay.co.uk';
$submit_url = "http://signin.ebay.co.uk/aw-cgi/eBayISAPI.dll";
$data['userid'] = "VitoGambino-us";
$data['pass'] = "P0wqw12vi";
$data['MfcISAPICommand'] = 'SignInWelcome';
$data['siteid'] = '0';
$data['co_partnerId'] = '2';
$data['UsingSSL'] = '0';
$data['ru'] = '';
$data['pp'] = '';
$data['pa1'] = '';
$data['pa2'] = '';
$data['pa3'] = '';
$data['i1'] = '-1';
$data['pageType'] = '-1';
$curl->curl_cookie_set($referer);
$result = $curl->curl_post_request($referer, $submit_url, $data);
echo $result;
Here is what the cookie files contents are:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
www.ebay.co.uk FALSE / FALSE 0 JSESSIONID BDE9B23B829CA7DF2CC4D5880F5173A6
.ebay.co.uk TRUE / FALSE 0 ebay %5Esbf%3D%23%5Ecv%3D15555%5E
.ebay.co.uk TRUE / FALSE 1431871451 dp1 bu1p/QEBfX0BAX19AQA**53776c5b^
#HttpOnly_.ebay.co.uk TRUE / FALSE 0 s CgAD4ACBRl4pbYjJjZDk1YTAxM2UwYTU2YjYzYzRhYmU0ZmY2ZjcyODYBSgAXUZeKWzUxOTYzOGI5LjMuMS43LjY2LjguMC4xuMWzLg**
.ebay.co.uk TRUE / FALSE 1400335451 nonsession CgADLAAFRlj/jMgDKACBa/DpbYjJjZDk1YTAxM2UwYTU2YjYzYzRhYmU0ZmY2ZjcyODcBTAAXU3dsWzUxOTYzOGI5LjMuMS42LjY1LjEuMC4xhVUTMQ**
.ebay.co.uk TRUE / FALSE 1526479451 lucky9 4551358
I was able to figure it out.
eBay uses a pretty tricky method for logging in. It's a combination of cookies, hidden fields and a javascript redirect after successful login.
Here's how I solved it.
Newly modified class:
class Curl {
private $ch;
private $cookie_path;
private $agent;
// userId will be used later to keep multiple users logged
// into ebay site at one time.
public function __construct($userId) {
$this->cookie_path = dirname(realpath(basename($_SERVER['PHP_SELF']))).'/cookies/' . $userId . '.txt';
$this->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
}
private function init() {
$this->ch = curl_init();
}
private function close() {
curl_close ($this->ch);
}
// Set cURL options
private function setOptions($submit_url) {
$headers[] = "Accept: */*";
$headers[] = "Connection: Keep-Alive";
curl_setopt($this->ch, CURLOPT_URL, $submit_url);
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->agent);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie_path);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie_path);
}
// Grab initial cookie data
public function curl_cookie_set($submit_url) {
$this->init();
$this->setOptions($submit_url);
curl_exec ($this->ch);
echo curl_error($this->ch);
}
// Grab hidden fields
public function get_form_fields($submit_url) {
curl_setopt($this->ch, CURLOPT_URL, $submit_url);
$result = curl_exec ($this->ch);
echo curl_error($this->ch);
return $this->getFormFields($result);
}
// Send login data
public function curl_post_request($referer, $submit_url, $data) {
$post = http_build_query($data);
curl_setopt($this->ch, CURLOPT_URL, $submit_url);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($this->ch, CURLOPT_REFERER, $referer);
$result = curl_exec ($this->ch);
echo curl_error($this->ch);
$this->close();
return $result;
}
// Show the logged in "My eBay" or any other page
public function show_page( $submit_url) {
curl_setopt($this->ch, CURLOPT_URL, $submit_url);
$result = curl_exec ($this->ch);
echo curl_error($this->ch);
return $result;
}
// Used to parse out form
private function getFormFields($data) {
if (preg_match('/(<form name="SignInForm".*?<\/form>)/is', $data, $matches)) {
$inputs = $this->getInputs($matches[1]);
return $inputs;
} else {
die('Form not found.');
}
}
// Used to parse out hidden field names and values
private function getInputs($form) {
$inputs = array();
$elements = preg_match_all('/(<input[^>]+>)/is', $form, $matches);
if ($elements > 0) {
for($i = 0; $i < $elements; $i++) {
$el = preg_replace('/\s{2,}/', ' ', $matches[1][$i]);
if (preg_match('/name=(?:["\'])?([^"\'\s]*)/i', $el, $name)) {
$name = $name[1];
$value = '';
if (preg_match('/value=(?:["\'])?([^"\'\s]*)/i', $el, $value)) {
$value = $value[1];
}
$inputs[$name] = $value;
}
}
}
return $inputs;
}
// Destroy cookie and close curl.
public function curl_clean() {
// cleans and closes the curl connection
if (file_exists($this->cookie_path)) {
unlink($this->cookie_path);
}
if ($this->ch != '') {
curl_close ($this->ch);
}
}
}
The actual code in use:
$curl = new Curl(md5(1)); //(md5($_SESSION['userId']));
$referer = 'http://ebay.com';
$formPage = 'http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn';
// Grab cookies from main page, ebay.com
$curl->curl_cookie_set($referer);
// Grab the hidden form fields and then set UsingSSL = 0
// Login with credentials and hidden fields
$data = $curl->get_form_fields($formPage);
$data['userid'] = "";
$data['pass'] = "";
$data['UsingSSL'] = '0';
// Post data to login page. Don't echo this result, there's a
// javascript redirect. Just do this to save login cookies
$formLogin = "https://signin.ebay.com/ws/eBayISAPI.dll?co_partnerId=2&siteid=3&UsingSSL=0";
$curl->curl_post_request($referer, $formLogin, $data);
// Use login cookies to load the "My eBay" page, viola, you're logged in.
$result = $curl->show_page('http://my.ebay.com/ws/eBayISAPI.dll?MyeBay');
// take out Javascript so it won't redirect to actualy ebay site
echo str_replace('<script', '<', $result);
I used some of the code posted here, thanks to drew010!
I have been trying to run this sript for weeks now.
What I want is this to be sending data to the server shown there and return the server response but all I'm getting from the response is the url but the url is not executed it only getting displayed on the response var
<?php
class send
{
public $username;
public $password;
public $destination;
public $sender;
public $msg;
public $type;
public $dlr;
public $url;
function __construct()
{
}
function send_sms(){
$posturl = 'http://121.241.242.114:8080/bulksms/bulksms?';
$number = $this->destination;
$msg = urlencode($this->msg);
$type='0';
$dlr='1';
$url='';
$posturl = $posturl."source=".$this->sender."&username=".$this->username."&password=".$this->password."&type=".$type."&dlr=".$dlr."&destination=".$number."&message=".$msg;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $posturl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
$response = curl_exec($ch);
return $posturl;
}
}
?>
return $response; //and not $posturl