How to read servlet response using PHP

I would like to send a request to a Java servlet with PHP and get a response from it and show it on the PHP page. How to do it?

Thanks and Regards

Abishek R. Shrikiant

+3
source share
4 answers

If all you need to do is to give the GET request response to an external resource, simple vanilla in your PHP response, then you can use file_get_contents()for this.

<?php echo file_get_contents("http://example.com/someservlet"); ?>

The servlet method will be called doGet()and any response that it returns (which may even be a JSP forwarded) will be printed as a PHP response string.

, , POST -, curl(). PHP .

, , , HTML, , HTML. , <html> . PHP w3 validator, . HTML, <body> <iframe>.

<iframe src="http://example.com/someservlet"></iframe>
+6

, php, php?

file_get_contents URL- ( , - ), -,

:

$content = file_get_content('http://www.google.com');
echo $content;

, - . php , cookie .., .

,

+1

, , ...

, Java - SOAP, RPC .. -.

, GET, file_get_contents.

POST/PUT/DELETE, cURL. cURL , , ( ).

cURL, POST/PUT/DELETE, streams , .

cURL, POST/PUT/DELETE, , , , - .

, Spectral Wolf. . , Spectral Wolf, . Godspeed.

+1

, Java, , , , , Java- PHP.

PHP/Java Integration.

0

All Articles