Wednesday, November 25, 2015

Auto password Generator in PHP

As a developer sometime we have to put auto password generation in our registration to help user to get a strong password and their convenience. In PHP, it's very simple to create a auto password generator. PHP has two build in functions one is SUBSTR and another one is STR_SHUFFLE.

Subastr function can slice an specific length of characters from a given string, the function is

string substr ( string $string , int $start [, int $length ] )
The first parameter is the given string, second one is the starting point of substring and last one is for total length of sub string.You can see details in PHP manual

Saturday, November 21, 2015

SMS Gateway API Integration in PHP with Curl

API  stands for application program interface. As a programmer or developer we have to use several web service through API. API give  us privilege to integrate specific web service to use from the provider. There is a lot of good article on API you can found in  internet. Just google it, you will a lot of references. Today i am going to share basic of SMS gateway integration in your application like, school management software, Client management system etc. I will use PHP as programming with a very powerful library which is called curl.
We are using HTTP API of the  SMS gateway provider. To send the HTTP request we use curl here.

Here the code block, that is use



<?php if(isset($_POST['operation'])){ $number=$_POST['number']; $msg=$_POST['msg']; //sms gateway api link $url="http://121.241.242.114:8080/sendsms?username=syit-test&password=12345&type=0&dlr=1&destination=$number&source=DEMO&message=$msg"; $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $url); $contents = curl_exec($c); curl_close($c); echo 'SMS Sent, thank you'; }