Solved

Send URL in standard SMS txtlocal api

Posted on 2010-08-30
6
267 Views
Last Modified: 2013-12-13
Hi,
I am using txt local to send standard SMS's (not MMS) to phones. I want to be able to send a URL in the SMS - I know this is possible but I cant seem to be able to do it - I can sort of do it using MMS. I have included my code
Can anyone tell me how to do this please?
I have included my code.

<?

class sms{



	public 	$from,

		$to,

		$msg,

		$testmode,

		$debug,

		$api,

		$wappush,

		$username,

		$password,

                $shed;



	function sms(){

                $CI =& get_instance();

		$config=$CI->config->item('sms');

		$this->from=$config['from'];

		$this->testmode=$config['testmode'];

		$this->debug=$config['debug'];

		$this->api=$config['api'];

		$this->wappush=false;

		$this->username=$config['username'];

		$this->password=$config['password'];

                $this->shed="";

	}



	function wappush($wappush=true){

		$this->wappush=$wappush;

	}



	function to($to){

		$this->to=$to;

	}



	function cc($no){

		if($this->to=="")

			$this->to=$no;

		else

			$this->to.=','.$no;

	}



	function msg($msg){

		$this->msg=urlencode($msg);

	}

        /*YYYY-MM-DD-HH-MM-SS 

         * e.g 2008-03-28-14-56-00

         */

        function schedule($time){

		$this->shed=$time;

	}



	function send(){

		$data = "uname=".$this->username.

			"&pword=".$this->password.

			"&message=".$this->msg.

			"&from=". $this->from.

			"&selectednums=".$this->to.

			"&info=".$this->debug.

			"&test=".$this->testmode;

                 $data.=($this->shed!="")?"&shed=".$this->shed:"";#If scheduled time then set it

                 $data.=($this->wappush!=false)?"&url=".$this->wappush:"";#If  push then send url



		// Send the POST request with cURL

		$ch = curl_init($this->api);

		curl_setopt($ch, CURLOPT_POST, true);

		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

		$result = curl_exec($ch); //This is the result from Txtlocal

		curl_close($ch);

	}





}?>

Open in new window

0
Comment
Question by:jdav357
  • 3
  • 3
6 Comments
 
LVL 2

Author Comment

by:jdav357
ID: 33558215
Please note I added this line;
$data.=($this->wappush!=false)?"&url=".$this->wappush:"";#If  push then send url

but did not work..
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 33558596
Do you mean to send a URL or an anchor-tag encoded link?  A URL should just be a plain text string, right?
0
 
LVL 2

Author Comment

by:jdav357
ID: 33561672
Ah sorry - yes i mean an anchor tag.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 33562854
Not sure what might happen if you try to send an HTML link with an SMS message.  IIRC SMS is purely plain-text.  So maybe it is the wrong tool for sending HTML.  If you want to try and text me with this script, please send the text to 703.346.0600
0
 
LVL 2

Author Comment

by:jdav357
ID: 33565378
Hi thanks, I am now trying to send it as an MMS, but for some reason the code is not working. As the question is now substantially different to my original one, I will close the question and award you the points.
Thanks again for your help.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 33565432
Thanks for the points.  Sorry I cannot be a guinea pig for MMS - I have a dumb phone :-(

Best, ~Ray
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Popup to change image and store url in database 2 30
get domain with php 7 19
is this a cms? 8 34
Selecting SUM data from mysql table with PHP 4 0
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now