Simple GET request with PHP cURL to send SMS text message -
i'm creating quick web app needs send php-created message within php code. curl apparently tool job, i'm having difficulty understanding enough working.
the documentation api i'm dealing here. in particular want use simple get-based sms notification documented here. latter resource states api simply:
http://sms2.cdyne.com/sms.svc/simplesmssend?phonenumber={phonenumber}&message={message}&licensekey={licensekey}
and indeed, if type following url browser, expected results:
http://sms2.cdyne.com/sms.svc/simplesmssend?phonenumber=15362364325&message=mymessage&licensekey=2134234882347139482314987123487
i trying create same affect within php. here attempt:
<html> <body> <?php $num = '13634859126'; $message = 'some swanky test message'; $ch=curl_init(); curl_setopt($ch, curlopt_url, "http://sms2.cdyne.com/sms.svc/simplesmssend?phonenumber=".urlencode($num)."&message=".urlencode($message)."&licensekey=2345987342583745349872"); curl_setopt($ch, curlopt_header, 0); curl_exec($ch); curl_close($ch); ?> </body> </html>
my other php webpages work fine, know php , apache set correctly. when point browser @ above page, no message on phone. can show me i'm doing wrong?
note: numbers faked... might have suspected.
do need curl? use php's file_get_contents($url)
, request , return response value.
Comments
Post a Comment