Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5942357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:14:31+00:00 2026-05-22T16:14:31+00:00

I would like to send a request to a Java Servlet from PHP and

  • 0

I would like to send a request to a Java Servlet from PHP and receive the response from the same and show it on the PHP page. How should this be done?

Thanks and Regards

Abishek R Srikaanth

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:14:32+00:00Added an answer on May 22, 2026 at 4:14 pm

    If all you want is to print the response of a GET request to an external resource plain vanilla into the PHP response, then you can use file_get_contents() for that.

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

    The servlet’s doGet() method will be invoked and whatever response it returns (which can even be a forwarded JSP) will be printed as string to the PHP response.

    If you want a little more fine grained control, e.g. using POST or something, then head to curl() instead. The linked PHP manual contains several examples.

    Regardless of the way, please note that whenever it returns HTML, that you should ensure that you end up with valid HTML. For example, nesting <html> tags is illegal. Pass the PHP page through the w3 validator if you’re unsure. Otherwise you’d better have to parse the HTML to extract the <body> pieces of interest or to use an <iframe> instead.

    <iframe src="http://example.com/someservlet"></iframe>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to send a html string with a GET request like this
I've writen a function to send and receive message from server like this: //Send
I would like to know how to send a post request in curl and
I would like to send mail from a script on a Windows Server 2003
I would like to send some keystrokes from a C++ program into another window.
I would like to send an email from an application that contains the current
I'm using a Rails application and would like to send/receive text messages through my
I would like to send an http post request in c++. It seems like
I would like used Ext.data.Request to send request to my server. But i don't
Ideally, I would like to send an HTTP Request using POST to the Push

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.