![](/img/trans.png)
[英]Java TCP send and receive multiple messages between client & server side on same socket
[英]Receive value in server side( reslet java ) send from client side (php )
邮递区号
$name = $_REQUEST[ 'name' ];
// Create the client object.
$url = 'http://localhost:8182/hello?'.$name;
$ch = curl_init( $url );
// Set Curl options
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
// Make the request
echo $response = curl_exec( $ch ); // Just getting "hello, world" and not the name.
?>
我的Java代码。
@Get
public String present( String name ){
String name = getQuery().getValues("name");
return "hello, world"+name;
}
我正在做的是,尝试从客户端即php向服务器端java(restlet)发送名称。 谁能指导我如何完成这项任务?
编辑此行
// Create the client object.
$url = 'http://localhost:8182/hello?name='.$name;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.