Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

servlet in php for applet

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

servlet in php for applet

Postby Elefante » Wed Sep 04, 2013 9:31 am

I have an applet that I miss the servlet.
I thought about using a php file instead.
The file is activated but I do not receive the file sent by the applet.
How can I do?

The applet:
Code: Select all
public boolean invokeServlet(String baseUrl, File pdfFile, String
formName, String tipoDoc, String sessionId)
throws Exception
{
URL url = new URL((new
StringBuilder(String.valueOf(baseUrl))).append("/ScannerServlet").toString());
java.net.URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection)connection;
httpConn.setRequestProperty("Cookie", (new
StringBuilder("JSESSIONID=")).append(sessionId).toString());
httpConn.setRequestProperty("formName", formName);
httpConn.setRequestProperty("tipoDoc", tipoDoc);
httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
//http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html
OutputStream out = httpConn.getOutputStream();
GZIPOutputStream os = new GZIPOutputStream(out);
int BUFFER_SIZE = 32000;
InputStream is = new FileInputStream(pdfFile);
int bytesRead = 0;
byte buffer[] = new byte[32000];
while((bytesRead = is.read(buffer)) != -1)
{
os.write(buffer, 0, bytesRead);
os.flush();
}
os.close();
is.close();
out.close();
return httpConn.getResponseCode() < 300;
}


The data that i receive:
a:5:{s:7:"GLOBALS";a:5:{s:7:"GLOBALS";R:2;s:5:"_POST";a:0:{}s:4:"_GET";a:0:{}s:7:"_COOKIE";a:2:{s:4:"lang";s:7:"italian";s:10:"JSESSIONID";s:32:"473DC4C221BA0A5A0B0732A031655449";}s:6:"_FILES";a:0:{}}s:5:"_POST";a:0:{}s:4:"_GET";a:0:{}s:7:"_COOKIE";a:2:{s:4:"lang";s:7:"italian";s:10:"JSESSIONID";s:32:"473DC4C221BA0A5A0B0732A031655449";}s:6:"_FILES";a:0:{}}
Elefante
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Sep 04, 2013 9:24 am

Re: servlet in php for applet

Postby johnj » Sun Sep 08, 2013 2:56 am

where is the php file?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: servlet in php for applet

Postby Elefante » Sun Sep 08, 2013 5:58 am

file_put_contents("file.txt", serialize($_REQUEST));
Elefante
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Sep 04, 2013 9:24 am


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron