Class sendSms{ function sendMsg($nuOfMsg){ $username = “Username”; $password = “Password”; // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, ‘http://www.160by2.com/LoginCheck.aspx’); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, ‘htxt_UserName=’ . $username . ‘&txt_Passwd=’ . $password); // IMITATE CLASSIC BROWSER’S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, ‘cookie.txt’); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); // SET PAGE TO SMS COMPOSE curl_setopt($ch, CURLOPT_URL, ‘http://www.160by2.com/postview.aspx’); // EXECUTE 2nd REQUEST $store = curl_exec ($ch); /* SET POST PARAMETERS : FORM VALUES FOR EACH FIELD. Replace ’MobileNumber. with your number with no preceding zeroes or 91.It shud be strictly 10 digit number . The Second ‘MobileNumber’ should also follow the same i.e write only 10 digit mobile number. */ curl_setopt ($ch, CURLOPT_POSTFIELDS, ‘txt_mobileno=MobileNumber&txt_msg=Total NEW Mails in Username@gmail is:’ . $nuOfMsg . ‘&act_mnos=91MobileNumber’); // EXECUTE 2nd REQUEST curl_exec ($ch); // CLOSE CURL curl_close ($ch);}}