简体   繁体   English

如何使用java读取php echo语句

[英]how to read php echo statement using java

How do i make java read this php file. 我如何使Java读取此php文件。 this php file should be read from it url: http://www.example.com/my/php/doc.php (this is not the real url) 该php文件应从以下网址读取: http : //www.example.com/my/php/doc.php (这不是真实网址)

//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. 通过使用Java应用程序,它应该能够读取php echo并在netbean中显示。 I hope my explanation is brief and simple enough. 我希望我的解释足够简短。 any idea everybody 大家都知道

Official tutorial, found by ... googling: http://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html 官方教程,可通过以下方式找到:谷歌搜索: 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();
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM