Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Getting source of webpage

Getting source of webpage

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Getting source of webpage

Postby nr1 » Tue Aug 11, 2009 6:29 pm

Hi,

what is the easiest way to get the source of a webpage in a string variable?

thx
nr1
Junior Developer
Junior Developer
 
Posts: 24
Joined: Tue Aug 11, 2009 6:27 pm

Top

Postby Romeo Ordos » Wed Aug 12, 2009 10:43 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. String tmpstr;
  3.  
  4. HttpClient client = new DefaultHttpClient();
  5.  
  6. HttpGet get = new HttpGet("http://some.url.com");
  7.  
  8. try
  9.  
  10.  HttpResponse rsp = client.execute(get);
  11.  
  12.  tmpstr = EntityUtils.toString(rsp.getEntity());
  13.  
  14. catch (ClientProtocolException e)
  15.  
  16.  {
  17.  
  18.   // TODO
  19.  
  20.  }
  21.  
  22. catch (IOException e)
  23.  
  24.  {
  25.  
  26.   // TODO
  27.  
  28. }
  29.  
  30.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4


tmpstr is your string with sourcecode.
Romeo Ordos
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Aug 06, 2009 6:30 pm
Location: Donetsk, Ukraine

Postby nr1 » Wed Aug 12, 2009 6:11 pm

thx!
nr1
Junior Developer
Junior Developer
 
Posts: 24
Joined: Tue Aug 11, 2009 6:27 pm

Postby porzino » Thu Oct 08, 2009 3:21 pm

Hi,

I have try this solution and I have a problem: I only get the first 8K of the web (The size is 300K)

Any ideas?
porzino
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 08, 2009 3:17 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 3 guests