Hi,
as i dont know any thing about php script and java script.
in my html code the first page is redirecting to second page
i need to read the second page source code in i tried using the code in the
link using that i am reading the first page source
i amno getting the second page source code so that i am asking to extend
some more help


following is the code i am trying
 String url = "http://ncpo.cc/test/example.php";;

    Button login;
    org.apache.http.HttpResponse response;
    WebView mWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.openingwebpage);
        mWebView = (WebView) findViewById(R.id.webView1);
        Log.d("Calc", "gghfhfhf");
        mWebView.setWebViewClient(new HelloWebViewClient());
        Log.d("Calc", "gghfhfhf ghgfhhg");
        mWebView.getSettings().setJavaScriptEnabled(true);
        Log.d("Calc", "gghfhfhfghjghjgjhggkhljjk;kl''");
        mWebView.clearCache(true);

        mWebView.setWebChromeClient(new WebChromeClient());
        Log.d("Calc", "gghfhfhf  swathi                  1");

        mWebView.addJavascriptInterface(new HtmlHandler(), "HTMLOUT");
        //
mWebView.loadUrl("javascript:window.HTMLOUT.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
        mWebView.loadUrl(url);

    }

    private class HelloWebViewClient extends WebViewClient {

        @Override
        public void onPageFinished(WebView view, String url) {
            // TODO Auto-generated method stub
            super.onPageFinished(view, url);
            //
mWebView.loadUrl("javascript:window.HTMLOUT.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");

        }

    }

    final class HtmlHandler {
        public void processHTML(String html) {
            // process the html as needed by the app
            Log.d("dgdffghgh", "swathi in hyderabad");
            Get_Webpage obj = new Get_Webpage(url);
            Log.d("swathi", "gghfhfhf  swathi
loading");
            String source = obj.get_webpage_source();

            Log.d("html loading", source);
        }
    }
    String html = "";


    String line = null;
    public class Get_Webpage {

        public String parsing_url = "";

        public Get_Webpage(String url_2_get) {
            parsing_url = url_2_get;
        }



        public String get_webpage_source() {
            try {
                HttpClient client = new DefaultHttpClient();
                HttpGet request = new HttpGet(parsing_url);
                HttpResponse response = client.execute(request);
                InputStream in = response.getEntity().getContent();
                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(in));
                StringBuilder str = new StringBuilder();
                while ((line = reader.readLine()) != null) {
                    str.append(line);
                }
                in.close();
                html = str.toString();
            } catch (ClientProtocolException e) {

            } catch (IOException e) {

            }



            return html;
        }

    }

}














On Fri, Mar 16, 2012 at 10:51 AM, Justin Anderson <[email protected]>wrote:

> Hi Mark Murphy,
>> will you please help me in reading html source code
>>
>
> Ummm... he already helped you.  Follow the link he gave you and try to
> implement some of the stuff that is recommended in that post.
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
>
> On Thu, Mar 15, 2012 at 10:56 PM, chowdary nani 
> <[email protected]>wrote:
>
>> Hi Mark Murphy,
>> will you please help me in reading html source code
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to