POST data from PHP and GET data in java servlet -
is there method can retrieve data (eg, username , password) php java servlet? thanks
create post request in php:
use curl:
$ch = curl_init('http://www.example.com:8080/my-servlet/'); $data = '...' # data want send curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($curl, curlopt_returntransfer, true); $response = curl_exec($ch); curl_close($ch);
a better, more concise approach, using pecl_http:
$response = http_post_data('http://www.example.com:8080/my-servlet/', $data);
Comments
Post a Comment