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 8284119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:58:44+00:00 2026-06-08T10:58:44+00:00

i have this simple php code and want to use this code in a

  • 0

i have this simple php code and want to use this code in a java app
in this way that the user enter the id in java console and check the Status of that id then show that to user

should i change this code to java code??
and how? plz help me

<?php
// www.webmn.net
function yahoo($id){
$url = 'http://opi.yahoo.com/online?u=';
$data = file_get_contents($url . $id);
if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
return (strlen($data) == 140) ? 'online' : 'offline';
} else {
return trim(strip_tags($data));
}
}
?>
  • 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-06-08T10:58:46+00:00Added an answer on June 8, 2026 at 10:58 am

    you can put php file in your sever , and then send a post request to it from your java app using this function

    public static String httpPost(String urlStr, String[] paramName,
                String[] paramVal) throws Exception {
                  URL url = new URL(urlStr);
                  HttpURLConnection conn =
                      (HttpURLConnection) url.openConnection();
                  conn.setRequestMethod("POST");
                  conn.setDoOutput(true);
                  conn.setDoInput(true);
                  conn.setUseCaches(false);
                  conn.setAllowUserInteraction(false);
                  conn.setRequestProperty("Content-Type",
                      "application/x-www-form-urlencoded");

              // Create the form content
              OutputStream out = conn.getOutputStream();
              Writer writer = new OutputStreamWriter(out, "UTF-8");
              for (int i = 0; i < paramName.length; i++) {
                writer.write(paramName[i]);
                writer.write("=");
                writer.write(URLEncoder.encode(paramVal[i], "UTF-8"));
                writer.write("&");
              }
              writer.close();
              out.close();
    
              if (conn.getResponseCode() != 200) {
                throw new IOException(conn.getResponseMessage());
              }
    
              // Buffer the result into a string
              BufferedReader rd = new BufferedReader(
                  new InputStreamReader(conn.getInputStream()));
              StringBuilder sb = new StringBuilder();
              String line;
              while ((line = rd.readLine()) != null) {
                sb.append(line);
              }
              rd.close();
    
              conn.disconnect();
              return sb.toString();
            }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Java code that works on my desk top...its a simple app that
i have this simple code to load data from other php page using get
Possible Duplicate: Check if a variable is empty Simple PHP question: I have this
i have used this code in my index.php to get user facebook first name
I currently have this piece of code: NSString *strURL = [NSString stringWithFormat:@http://www.sample.com /phpFile.php?firstname=%@,txtfirstName.text]; NSString
I have a site with this simple structure: \public_html {files}.php \files \es For the
i have made a simple php contact form following this tutorial: http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme The big
Im sure this is simple but newbie here. I have 5 URLS cards.php&type=one cards.php&type=two
I have a simple form like this : <form method=post name=change_pass id=change_pass action=change_pass2.php> <input
i would like a simple help... i have a url like this: example.com/profile.php?id= &

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.