既然是HTTP的服务,就应该包括各种基于HTTP协议的请求方式,GET,POST,FILE等,那么如果通过Flex的HTTP服务去从服务器获取数据呢?简单,看例子先
1、基于file
creationComplete="rest_service.send()" viewSourceURL="srcview/index.html">
dataProvider="{rest_service.lastResult.kyins.kyin}" fontFamily="Arial" fontSize="12">
。。。。。。。。。。。。。。。。。。
2、基于GET
resultFormat="text" result="resultHandler(event)"/>
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
public function resultHandler( event: ResultEvent ):void
{
Alert.show( "Result "+String(event.result) );
}
public function sendData( ):void
{
var objSend:Object = new Object;
objSend.first = textInput.text;
objSend.second = textInput1.text;
writeData.send( objSend );
}
]]>
//php代码
$Text = "First is ".$_GET["first"];
$Text .= "\nSecond is ".$_GET["second"];
//print_r($Text);
file_put_contents( "data.txt", $Text );
//you could easily write code here that will update data in a database
?>
3、基于POST
阅读(1424) | 评论(0) | 转发(0) |