Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Sockets and Internet Protocols
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Sockets and Internet Protocols
post html login
Alex Ter
Greenhorn
Posts: 10
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi again,
so I allow myself to post a new topic cause the problem basically changed, I can't post as I want to login, still geting the login page as a result:
thanks
for the help
import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.HttpConnection; import java.net.URLEncoder; import java.net.URLConnection; import java.net.URL; import java.io.*; import java.io.IOException; class ConnectIntellio1 { public static void main(String[] args) { OutputStreamWriter writer = null; BufferedReader reader = null; try { String encodedData = URLEncoder.encode("UserID","UTF-8"); URL url = new URL ("http://www.intellio.fr/extranet/index.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(encodedData); writer.flush(); reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String ligne; while ((ligne = reader.readLine()) != null) { System.out.println(ligne); } //InputStream responseBody = conn.getInputStream(); //File f=new File("outFile.html"); /*BufferedOutputStream out=new BufferedOutputStream( new FileOutputStream( f.getName() ) ); byte buf[]=new byte[1024]; int len; while((len=responseBody.read(buf))>0) out.write(buf,0,len); out.close(); responseBody.close(); System.out.println("Fichier créé");*/ } catch (Exception e) { System.err.println("Fatal protocol violation: " + e.getMessage()); e.printStackTrace();} finally { try{writer.close();}catch(Exception e){} try{reader.close();}catch(Exception e){} } } }
Rob Spoor
Sheriff
Posts: 22781
131
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't see why we can't continue in
your other thread
. I don't think Nitesh will mind if I close this
thread
.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Bad Class Access Flags Alert
ZipException - invalid entry compressed size
File COuld not be posted on IIS 5.0 via Servlet
Multithreading client socket throws Stream corrupted exception
extract strings
More...