blog.Ring.idv.tw

Zend_Http發送簡訊 - 使用TWSMS

Zend_Http發送簡訊 - 使用TWSMS


這裡提供一個透過TWSMS發送簡訊的小範例,利用Zend Framework所提供的Zend_Http蠻方便的~

$message = urlencode("測試中文");

$client = new Zend_Http_Client();
$client->setUri("http://api.twsms.com/send_sms.php?username=xxxx&password=xxxx&type=now&encoding=big5&mobile=09xxxxxxxx&message=$message&vldtme=3600");
$client->setConfig(array(
    'maxredirects' => 0,
    'timeout'      => 30)
);

$client->setMethod(Zend_Http_Client::GET);
$response = $client->request();
	
if ($response->isError())
{
	echo "Server reply was: " . $response->getStatus() . " " . $response->getMessage() . "\n";
}else{
	$body = $response->getBody();
	echo $body;
}

2007-11-27 16:13:08

Leave a Comment

Copyright (C) Ching-Shen Chen. All rights reserved.

::: 搜尋 :::

::: 分類 :::

::: Ads :::

::: 最新文章 :::

::: 最新回應 :::

::: 訂閱 :::

Atom feed
Atom Comment

::: 人氣指數 :::

今日人氣:461

累積人氣:3006743


::: 線上人數 :::

counter