Hi guys,
I have a very simple php script that's supposed to work but doesn't. The script looks like this...
<?php
$response = file_get_contents("http://localhost:8090/MyWebApp/MyServlet", false, NULL)
echo $response
?>
which seems to return nothing. This is supposed to call a java servlet on the local machine. However, the servlet does not get called (I put a breakpoint in the servlet so I'd know if it were called).
When I navigate to this php from a web browser, I get back an empty page (as if there's an error or something). However, if I change the above line to use http://www.google.com as the URL, it works (I can hit the php page from my browser and get back a google-looking page, minus some pictures and what not).
For some reason, the call to a localhost URL does not seem to work, even though the servlet is, in fact, running. I have tested this by calling "curl http://localhost:8090/MyWebApp/MyServlet" from my linux terminal and correctly getting the servlet response.
Does anyone know why this does not work in PHP?
Thanks,
--Ronen