رفتن به مطلب

سوال درمورد سرویس پیامک


پست های پیشنهاد شده

سلام من از سرویس url شرکت پیام رسان استفاده میکنم این شرکت برای ارسال پیام کوتاه این کد رو پیشنهاد داده


<?php
class HttpSample {
$USERNAME = "PayamResanUserNme"; // your username (fill it with your username)
$PASSWORD = "PayamResanPassWord"; // your password (fill it with your password)

// base http url
private $BASE_HTTP_URL = "http://www.payam-resan.com.com/APISend.aspx?";

public function enqueueSample() {
$USERNAME = "PayamResanUserNme"; // your username (fill it with your username)
$PASSWORD = "PayamResanPassWord"; // your password (fill it with your password) $senderNumber = "30007546"; // [FILL] sender number ; which is your 3000xxx number
$recipientNumber = "0912XXXXXXX"; // [FILL] recipient number; the mobile number which will receive the message (e.g 0912XXXXXXX)
$message = urlencode("payam-resan.com http-enqueue test"); // [FILL] the content of the message; (in url-encoded format !)

// creating the url based on the information above
$url = $this->BASE_HTTP_URL .
"Username=" . $this->USERNAME . "&Password=" . $this->PASSWORD .
"&From=" . $senderNumber . "&To=" . $recipientNumber .
"&Text=" . $message ;
// sending the request via http call
$result = $this->call($url);
// Now you can compare the response with 0 or 1
}
// this method provides a simple way of calling a url
private function call($url){
return file_get_contents($url);
}
}

خب حالا من این فایل رو تو صفحه ثبت نام اینکلود کردم و میخوام دو مقدار code و massage رو به این کد ارسال کنم تا اونم پیامک رو بفرستده ممنون میشم راهنمایی کنید.

لینک به ارسال

سلام

user و pass حساب کاربری تون رو جاهایی که نیازه داخل کد بنویسید. بعد می تونید مقادیر رو از طریق متدهای فرم ارسال و استفاده کنید.

لینک به ارسال

منظورتون همچین چیزی هست درسته ؟


<form action="Http://www.payam-resan.com/APISend.aspx" method="Post">
username : <input type="text" name="username" /><br />
password : <input type="text" name="password" /><br />
number mobile : <input type="text" name="to" /><br />
message : <input type="text" name="text" ><br />
<input type="hidden" name="From" value = "30007546" /><br />
<input type ="submit" name="Send" value = "Send" />
</form>

لینک به ارسال

خب این روش خیلی خطر ناکه و اصلاً به کار نمیاد بزار از اول توضیح بدم من فرم ثبت نام دارم حالا کاربر ثبت نام میکنه یه کد رندوم تولید میشه حالا میخوام این کد رندوم رو براش ارسال کنم ، از سرویس url شرکت پیام رسان استفاده میکنم این شکرت نمونه کد php ای که داده به من اینه


<?php
class HttpSample {
$USERNAME = "PayamResanUserNme"; // your username (fill it with your username)
$PASSWORD = "PayamResanPassWord"; // your password (fill it with your password)

// base http url
private $BASE_HTTP_URL = "http://www.payam-resan.com.com/APISend.aspx?";

public function enqueueSample() {
$USERNAME = "PayamResanUserNme"; // your username (fill it with your username)
$PASSWORD = "PayamResanPassWord"; // your password (fill it with your password) $senderNumber = "30007546"; // [FILL] sender number ; which is your 3000xxx number
$recipientNumber = "0912XXXXXXX"; // [FILL] recipient number; the mobile number which will receive the message (e.g 0912XXXXXXX)
$message = urlencode("payam-resan.com http-enqueue test"); // [FILL] the content of the message; (in url-encoded format !)

// creating the url based on the information above
$url = $this->BASE_HTTP_URL .
"Username=" . $this->USERNAME . "&Password=" . $this->PASSWORD .
"&From=" . $senderNumber . "&To=" . $recipientNumber .
"&Text=" . $message ;
// sending the request via http call
$result = $this->call($url);
// Now you can compare the response with 0 or 1
}
// this method provides a simple way of calling a url
private function call($url){
return file_get_contents($url);
}
}

حالا من باید چکار کنم تابع صدا بزنم که نمیشه چون توابع داخل این کد نمیتونن پارامتر بگیرن من موندم چیکار کنم ؟

لینک به ارسال

function SendSms($username,$pass,$from,$to,$msg)
{
$msg = urlencode($msg);

$url = "http://www.payam-resan.com.com/APISend.aspx?Username={$username}&Password={$pass}&From={$from}&To={$to}&Text={$msg}";

return file_get_contents($url);
}
//usage
echo SendSms("PayamResanUserNme" , "PayamResanPassWord" , '30000000098989','09121115588',"کد پيگيري شما 123456");

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...