Sunday, May 26, 2013

Generate URL-encoded query string (http_build_query) :



If you passed associative array and return result is query string with encoded.

Code:

<?php
$data = array('foo'=>'bar',
              'baz'=>'boom',
              'cow'=>'milk',
              'php'=>'hypertext processor');

echo http_build_query($data) . "\n";
echo http_build_query($data, '', '&amp;');

?>

OutPut:

foo=bar&baz=boom&cow=milk&php=hypertext+processor
foo=bar&amp;baz=boom&amp;cow=milk&amp;php=hypertext+processor

 


Friday, May 24, 2013

send sms from website in php


 Send message from your site to any one mobile , simply use this script and do it .Register in mvaayoo.com and get the username and password. Free account only get 20 messages.

$ch = curl_init();
$user="yourmail@gmail.com:yourpassword";
$receipientno="919849558211";
$senderID="mVaayoo";
$msgtxt="this is test message , test";
curl_setopt($ch,CURLOPT_URL,  "http://api.mVaayoo.com/mvaayooapi/MessageCompose");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt");
$buffer = curl_exec($ch);
if(empty ($buffer))
{ echo " buffer is empty "; }
else
{ echo $buffer; }
curl_close($ch);

special thanks to mvaayoo.com . cheers friends :)