1

How do i make java read this php file. this php file should be read from it url: http://www.example.com/my/php/doc.php (this is not the real url)

//from http://www.example.com/my/php/doc.php

<?php  
echo($strServer);
echo($strUrl);
echo($strdbName);
echo($strdbUser);
echo($strdbPass);;
echo($Name);
?>

by using java application it should be able to read php echo and display in netbean. I hope my explanation is brief and simple enough. any idea everybody

1

1 Answer 1

5

Official tutorial, found by ... googling: http://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html

import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {

        URL oracle = new URL("http://www.oracle.com/");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(oracle.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.