Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- URL obj = new URL("http://myphpurl/insert.php");
- HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
- conn.setReadTimeout(10000);
- conn.setConnectTimeout(15000);
- conn.setRequestMethod(POST_METHOD);
- conn.setDoInput(true);
- conn.setDoOutput(true);
- Map<String, String> params = new HashMap<String, String>();
- params.put("title", "العربية");
- OutputStream os = conn.getOutputStream();
- BufferedWriter writer =
- new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
- writer.write(getQuery(params));
- writer.flush();
- writer.close();
- os.close();
- BufferedReader in =
- new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
- String inputLine;
- while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
- }
- LOG.debug("response {}", response);
- in.close();
- response = null;
- inputLine = null;
- conn.disconnect();
- conn = null;
- obj = null;
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- <?php
- $posttitle = $_POST["title"];
- echo "$posttitle";
- echo urldecode($posttitle);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement