• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

how to post view source data to the url?

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
output of this :
<h2>GET</h2>array (  'module' => 'server',  'do' => 'test',)<h2>POST</h2>array (  'e' => 'Hi there!',)<h2>FILES</h2>array ()<h2>HEADERS</h2>array (  'Content-Type' => 'application/x-www-form-urlencoded',  'User-Agent' => 'Java/1.8.0_131',  'Host' => 'crawler.ankiti.com',  'Accept' => 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2',  'Connection' => 'keep-alive',  'Content-Length' => '13',)<h2>SERVER</h2>array (  'CONTENT_TYPE' => 'application/x-www-form-urlencoded',  'HTTP_USER_AGENT' => 'Java/1.8.0_131',  'HTTP_HOST' => 'crawler.ankiti.com',  'HTTP_ACCEPT' => 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2',  'HTTP_CONNECTION' => 'keep-alive',  'CONTENT_LENGTH' => '13',  'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',  'SERVER_SIGNATURE' => '<address>Apache/2.4.18 (Ubuntu) Server at crawler.ankiti.com Port 80</address>',  'SERVER_SOFTWARE' => 'Apache/2.4.18 (Ubuntu)',  'SERVER_NAME' => 'crawler.ankiti.com',  'SERVER_ADDR' => '172.31.2.190',  'SERVER_PORT' => '80',  'REMOTE_ADDR' => '103.225.41.154',  'DOCUMENT_ROOT' => '/sata1/server/ankiti3/web/hosts',  'REQUEST_SCHEME' => 'http',  'CONTEXT_PREFIX' => '',  'CONTEXT_DOCUMENT_ROOT' => '/sata1/server/ankiti3/web/hosts',  'SERVER_ADMIN' => '[no address given]',  'SCRIPT_FILENAME' => '/sata1/server/ankiti3/web/hosts/index.php',  'REMOTE_PORT' => '14708',  'GATEWAY_INTERFACE' => 'CGI/1.1',  'SERVER_PROTOCOL' => 'HTTP/1.1',  'REQUEST_METHOD' => 'POST',  'QUERY_STRING' => 'module=server&do=test',  'REQUEST_URI' => '/?module=server&do=test',  'SCRIPT_NAME' => '/index.php',  'PHP_SELF' => '/index.php',  'REQUEST_TIME_FLOAT' => 1500099370.1819999,  'REQUEST_TIME' => 1500099370,  'base_anklib' => '/sata1/server/ankiti3',)

now i want to post view source of www.thehindu.com in place of Hi there
 
Marshal
Posts: 78682
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please explain a little more: are you simply trying to read the text of a website? There is an example of that in the Java™ Tutorials; I can't remember where, but it might be in this section. I remember it being quite simple. Don't know how to get onto the next website.
I suggest you change your line 53 to read:-
responseSB.append(line).append(System.lineSeparator());
I think that will make the output a bit easier to read

Please remind yourself how the code tags work; I have corrected them for you.
I think your line 17 gives a good explanation of why we have a naming policy to maintain the professional atmosphere of this website.
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no i have to post view source data of www.thehindu.com instead of hi there
 
Campbell Ritchie
Marshal
Posts: 78682
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Presumably you want the crawler to find the text of thehindu for you. Don't know. Sorry. How do you get URLs from a crawler? Does it have any method to return a URL?
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont want crawler to find the text i want to post the view source of thehindu to crawler
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the view source of thehindu  


What is that?  Are you asking how to read and display the text of the html that is returned  by a site?   Like using the "View Source" in a browser?
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, a crawler is a server which is used for debugging in this if you post data in a string the data will enter in post array but as in java, this string is too long so it's giving me an error that Constant String too long.
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually, the string is too long that's the main problem
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had post a string to a server  using this code package post;

HOW to upload a file any type of file .jpg,.jpeg,pdf etc to the same server/url  i had used multi part bt it doesnt show any result
 
Saloon Keeper
Posts: 7551
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this was my problem, I'd use the Apache HttpComponents library for this: https://dzone.com/articles/file-upload-apache-httpclient
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, Tim I had tried using this but default Http client is depreciated and I'm getting error because of this
 
Tim Moores
Saloon Keeper
Posts: 7551
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpClient is different from HttpComponents (which is very much active, and not deprecated). But even If you are getting an error with HttpClient (which still works fine, so I doubt that whatever error you got is related to that), the solution is not to give up but to solve the issue. If need be, by posting the details to a software engineering forum
 
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic