Can not get POST to Work (Source code provided)

I ' m trying to Post to a PHP page. my PHP Page Shows Nothing
Can Someone Tell me if the is the correct way to use POST?
Here is the Code I Have Wrote:
public void postNewMapData(int count)
               String data = "THIS is`A test";
               String post_url= "http://localhost/DBconn.php";
               HttpConnection conn = null;
               OutputStream outputstream = null;
               try
conn = (HttpConnection)Connector.open(post_url);
     conn.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
               conn.setRequestProperty("Content-Language", "en-US");
               conn.setRequestProperty("Accept","application/octet-stream" );
               conn.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded");
                    conn.setRequestProperty( "Connection","close" );
                    conn.setRequestProperty( "Content-Length", Integer.toString(data.length()));
                    conn.setRequestMethod(HttpConnection.POST);
               outputstream = conn.openOutputStream();
                    outputstream.write(data.getBytes());
                    System.out.println("After write statement ["+status+"]");
                    System.out.println("After write statement ["+outputstream+"]");
                    outputstream.flush();
                    outputstream.close();
                    //outputstream = null;
               catch(IOException error)
                    System.out.println("IOException"+ error);
               count++;
}

Hello sir,
i have tried your given suggestion and it work very well in WKT-tool
kit emulator as well as sun one emulator .but my app is not running on
real device i.e connection is not establish.I have tried all the
solutions as for as my knowledge but i could not solve the
problem.Please help me I will be very thankful to you...
My code is as here....
class ThreadedConnection extends Thread
ThreadedConnection()
start();
public void run() {
IMEI=txtenterIMEIno.getString();
String url ="some url";
try
HttpConnection http = (HttpConnection) Connector.open(url);
OutputStream oStrm = http.openOutputStream();
http.setRequestMethod(HttpConnection.GET);
http.setRequestProperty("Content-Type","application/x-www-form-urlencod
ed");
http.setRequestProperty("User-Agent","Profile/MIDP-1.0
Configuration/CLDC-1.0");
http.setRequestProperty("Content-Type", "text/plain");
http.setRequestProperty("IF-Modified-Since","20 Jan 2001
16:19:14 GMT");
http.setRequestProperty("Connection", "close");
InputStream iStrm = http.openInputStream();
int length = (int) http.getLength();
if (length != -1)
byte serverData[] = new byte[length];
iStrm.read(serverData);
currentInfo = new String(serverData);
else
ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
currentInfo = new String(bStrm.toByteArray());
bStrm.close();
System.out.println("File Contents: " +currentInfo);
}catch (Exception e) {}
}

Similar Messages

  • I just bought the BDP-S1500 yesterday and can not get it to work via wireless

    I just bought the BDP-S1500 yesterday and can not get it to work via wireless????

    Hi BigDaddy317,
    Please the link below for further assistance in connecting your wireless device to the internet.
    https://us.en.kb.sony.com/app/answers/detail/a_id/33377/p/47329,47564,95482/c/65,66/kw/internet
    https://us.en.kb.sony.com/app/answers/detail/a_id/35983/p/47329%2C47564%2C95482/c/65%2C66/kw/internet
    Please let us know if you're getting the same result or the error messages that you see.
    Thanks,
    >Joffrey
    If my post answers your question, please mark it as "Accept as Solution"

  • I have a pioneer 50 inch plasma   I purchased new from the company back in 2005.   I tried to hook up an Apple Tv to the pioneer receiver that came with the TV.   I can not get it to work.   The receiver has two HDMI  inputs in the back.

    I have a pioneer 50 inch plasma + I purchased new from the company back in 2005.   I tried to hook up an Apple Tv to the pioneer receiver that came with the TV.   I can not get it to work.
    The receiver has two HDMI  inputs in the back.  However they say they are not for PC's.  Furthermore they must be set up by going to the home menu.    I tried everything, but I can not get the receiver to talk to the Apple TV. I even tried a connector that uses an HDMI to the Apple TV that has the other side of the cable as 5 RCA cables.  I could not get the receiver to see the Apple TV.   I have a newer TV in the house, it has no problem talking with the Apple TV.  But this older system seems to be handicapped in its ability to talk with the newer Apple TV system.
    My Email is [email protected] 
    Do you have any suggestions
    Thanks
    Bob

    I could not access the Apple TV on the television.   If I put the Apple TV directly into by TV, I have an external sound system (entertainment system), therefore I worry that I would by pass the audio.
    Thanks for taking your time to attempt to help!   Any more suggestions would be greatly appreciated.
    Bob

  • HT1203 i have tried this 6+ times to "How to share music between different accounts on a single computer" on my wifes mac and can not get it to work!! On my PC no problem but on the MAC it will not work, follow the instructions to the T but no go????

    i have tried this 6+ times to "How to share music between different accounts on a single computer" on my wifes mac and can not get it to work!! On my PC no problem but on the MAC it will not work, follow the instructions to the T but no go????

    It is almost as if the program does not exist on my computer. If I search for it, the only thing that comes up is the installer. I cannot find it anywhere despite the fact I have installed it numerous times, uninstalled it and conducted a fresh install, and the Adobe website checks says that it is installed.

  • My apple Id has been disabled. I have relogged on changed password and still can not get it to work on my Iphone

    My apple Id has been disabled. I have relogged on changed password and still can not get it to work on my Iphone

    Contact itunes support.  Click Contact Us at the bottom of this page.

  • HT4108 I have a hdmi connector and can not get a picture to come on my tv. Need help also bought the RCA cables and can not get it to work with my iPhone 4 g

    I have a hdmi dock connector and can not get  it to show on my tv. It's a iPhone 4g please help also have a RCA cable to and can not get it to work either

    With what apps?  Not all apps require video output.

  • Can not get message to work om iPad, Can not get message to work om iPad

    Can not get message to work on iPad

    Please be much more specific. What exactly happens when you try to send a message?

  • I can not get NETFLIX to work, does anyone have any suggestions.

    can not get NETFLIX to work, does anyone have any suggestions...
    I have downloaded and installed Silverlight..
    and uninstalled it and reinstalled it...
    I have called Microsoft and also called Netflix support..
    who advised me to call Microsoft.
    Microsoft advised to to call apple
    seriously?
    HELP!

    Have you tried a different web browser like Mozilla FireFox?
    Have you tried just restating your Mac?

  • I can not get reader to work on xp.

    I have installed the 9 on  Reader and can not get it to work. I installed Fixit to see and it does not work either. Is there a place on XP that needs to be checked or opened. This started after the the computer was attacked by virus and they got into the registry. Had this repaired and this is what makes me think  something is  not opened for readers to work. Any ideas out there.

    chuck59c wrote:
    I have installed the 9 on  Reader and can not get it to work. I installed Fixit to see and it does not work either. Is there a place on XP that needs to be checked or opened. This started after the the computer was attacked by virus and they got into the registry. Had this repaired and this is what makes me think  something is  not opened for readers to work. Any ideas out there.
    Sounds like your sytem didn't get repaired. I would take it back to the tech that worked on it.
    In the meantime, you haven't mentioned what happens when you try and get it to work so we have no syptoms to go on to help you. Plus, what is fixit?
    There is no place on XP that you need to do anything special to get Reader to work so again, sounds like your system is still hosed.

  • HT4528 just bought a ringtone app but can not get it to work

    just bought a ringtone app but can not get it to work, I can get to putting on my desktop but after that it wont tranfer to my "tones"
    Angela

    Contact the app developer for support.

  • The air port on my imac went off and i can not get it to work

    my air port on the imac weny off and i can not get it to work now

    Apple used to use airport name for everything.. is this the internal wireless card?? Or external airport router?
    If it is the internal wireless card, is it still listed in system profile.. and do a hardware test with your original CD.
    See http://support.apple.com/kb/ht1509
    The problems with Mavericks are very great.. if you upgrade installed anything can happen.. a common feature is the internal wireless card fails to work.
    Give details and we can figure it out.
    Here is discussion about the same thing as I think has happened to your imac in macbook.
    https://discussions.apple.com/thread/5219345?tstart=30

  • I dont know if anyone can help me but l can not get itunes to work on my computer

    i have uninstalled itunes and installed it again but l still can not get it to work on my computer . Can anyone help ?

    i have uninstalled itunes and installed it again but l still can not get it to work on my computer . Can anyone help ?

  • I can not get itunes to work on my Windows 7 32.

    Itunes was working fine until the update came into play for the 10.5 and I can not get itunes to work now. All I get is an error message saying it's not loaded correctly and error 7 and errror 5 =>> this is really getting hard to deal with cause I have deleted and added it back so many times I feel silly.. Please tell me someone out there can help me fix this problem...

    See the further information area of Troubleshooting issues with iTunes for Windows updates for download advice and direct links.
    tt2

  • I have Nortons security suite under the old version the Idenity protection worked I kept all my passwords under this which used a master pasword I did not save passwords any were else and now can not get it to work supplying passwords for my l0gon site.

    I have Norton's security suite under the old version the Idenity protection worked. I kept all my passwords under this which used a master pasword I did not save my passwords any were else and now can not get it to work supplying passwords for my logon site.

    Symantec need to correct a mistake they made with their add-ons. They originally updated their add-ons after quite a delay to work with Firefox 4.0 as shown here - http://community.norton.com/t5/Norton-Internet-Security-Norton/Firefox-4-compatibility-hotfix-is-now-available/td-p/428894
    They made an error with the update in only listing it as compatible with Firefox 4.0, so they will not install on Firefox 4.0.1 and subsequent Firefox security updates. Symantec have indicated they will be releasing an update to correct their error soon, for details see http://community.norton.com/t5/Norton-Internet-Security-Norton/Norton-Toolbar-not-compatible-with-FF-4-0-1/td-p/442788/page/12

  • Can not get wiki to work

    Hey there,
    I have been trying to set up Leopard server for over a week. I can not get DNS, Open Directory and Wiki to work for me. This is my 5th instal. The first attempt, I went with standard thinking that the ease of use would be an asset, but then after getting it going I realized that there was no FTP access with standard, which was not an option.
    INSTAL 2: I reformatted and went ahead with the advanced server this time around. In no time I had FTP; AFP; iChat and web services running fine. Then when I went to set up wiki i realized that I had to have DNS and Open Directory running before that would work. I guess that I should of read up on that one... I had actually created all of my users and groups in local directory which seemed to work fine for ftp; afp and ichat for a few days but I really wanted to get the wiki going.
    INSTAL 3: I reformatted, set up DNS (or at least I thought I did) Open Directory and then recreated all of my users and groups in Open directory. I quickly got afp running; then ftp and ichat (jabber) with no issues. But when I went ahead with wiki, I could not get it to work properly. I could log into the wiki from my LAN using the local domain name that I had chosen but could not get it to work when I would attempt to do it from home using my dyndns.org account which forwards to my office IP which is mapped through router port 80 to my servers local IP. When doing this I was taken to: http://myurl.dyndns.org/groups/workgroup/
    I got the message:
    "Not Found
    404: No group with that name (workgroup) hosted on this server"
    If I click on "Groups" the error goes away and I see my wiki group but if I clicked on it I would get:
    "Not Found
    404: No group with that name (marcato) hosted on this server"
    When I went back to the office I could still get at my wiki by going to my local url: minserver.local and then selecting groups and then clicking on the desired wiki and then logging in. I then tried to accessing it using the machine's local IP since that is essentially what is happening when I come in from the WAN side using my dyndns.org account. So i typed in its local address and got the 404 error. When I click on groups again, just like when I was home coming in over the WAN, I get the same message. Why would I be seeing the group but not able to log in to it. Why would it allow me to access and use the Wiki from the LAN using miniserver.local but not using the machine's static Local IP address?
    I then decided to go watch all of Sean Collin's videos on Leopard Server in oder to get a handle on this.
    INSTAL 4: Walked through everything with Sean's video up to getting DNS set up. It failed! At this point I was frustrated so I decided to throw in the towel on Advanced. I got out my old tiger installer and set up ftp on another older G4 and then went for INSTAL 5. This time I reverted back to Standard, got all of the services running fine but as soon as I got home I ran into the same issue with the wiki. I could not access it from outside of the Office LAN. I went through and opened every port recommended and still nothing. Then, in efforts to try to make it work and in frustration of the limitations of the Standard interface I upgraded the configuration from standard to advanced to see if I could get to the bottom of this. I went back to reading a bunch more stuff about Mac Server and found the Sudo Changeip -checkhostname. It gave me the proper IP of the server as well as the proper hostname but said that the DNS was not working properly and needed to be repaired. I tried a few hacks I found online but still could not get the DNS going properly
    I am not sure what to do now. In an ideal world I would love to get leopard Advanced running properly so that I could host the wiki, afp, ftp, and ichat (jabber) from the same machine. But no matter what I try I can not seem to wrap my head around DNS. Even if I could do it with Standard and keep the ftp on the old mac with tiger... This is frustrating since I feel really confident with setting up everything else, I just do not seem to be able to get DNS to work properly which I assume has to do with the problem with the wiki not working from the WAN.
    Can someone please help me here?

    I have tried a bunch of hacks to try to get things working and still nothing. I actually find that the server is running really slow now so I am clearly going to be starting from skratch again. I will wait for some advice before I proceed. Here is what I have set up:
    1. I made a fake url using dyndns which routes to the IP address of the router at work. I want to be able to use this address to access the wiki from WAN
    2. I have the following ports opened and assigned to my servers LAN address:
    On TCP 113 113 10.0.1.22 Identification Protocol
    On TCP 88 88 10.0.1.22 Kerberos
    On TCP 106 106 10.0.1.22 Mac OS X Server Password Server
    On TCP 25 25 10.0.1.22 Mail service smtp
    On TCP 123 123 10.0.1.22 Network Time Protocol (NTP)
    On Both 311 311 10.0.1.22 Remote Server Admin / Workgroup
    On TCP 22 22 10.0.1.22 SSH
    On Both 3283 3283 10.0.1.22 Server ARD
    On Both 5900 5900 10.0.1.22 Server VNC ARD
    On UDP 500 500 10.0.1.22 VPN
    On UDP 1701 1701 10.0.1.22 VPN
    On TCP 1723 1723 10.0.1.22 VPN
    On UDP 4500 4500 10.0.1.22 VPN
    On UDP 170 170 10.0.1.22 VPN L2TP
    On Both 80 80 10.0.1.22 Web Server on Mini
    On TCP 625 625 10.0.1.22 Workgroup Manager
    On TCP 21 21 10.0.1.22 ftp
    On Both 8443 8443 10.0.1.22 iCal SSL
    On Both 8008 8008 10.0.1.22 ical server
    On TCP 5190 5190 10.0.1.22 ichat Server
    On TCP 5220 5220 10.0.1.22 ichat Server
    On TCP 5222 5222 10.0.1.22 ichat Server
    On TCP 5223 5223 10.0.1.22 ichat Server
    On TCP 5298 5298 10.0.1.22 ichat Server
    On UDP 5190 5190 10.0.1.22 ichat Server
    On UDP 5297 5297 10.0.1.22 ichat Server
    On UDP 5298 5298 10.0.1.22 ichat Server
    On UDP 5353 5353 10.0.1.22 ichat Server
    On UDP 5678 5678 10.0.1.22 ichat Server
    On UDP 16384-16403 10.0.1.22 ichat Server
    On Both 7777 7777 10.0.1.22 ichat Server file
    On TCP 5269 5269 10.0.1.22 ichat Server to Server
    On Both 5109 5109 10.0.1.22 istat for mini server
    On Both 16563 16563 10.0.1.119 pc
    On Both 8086 8086 10.0.1.22 wiki server
    On Both 8010 8010 10.0.1.22
    3. I am not sure what is meant exactly by a fully qualified domain. From what I understood in Sean's Collin's videos was that this was a url that I was to make up on my local network and that putting the . at the end made it FQDN. I choose: miniserver.local. Am I totally missing the mark here?
    Here are the parts of the set up where I am really confused:
    a. When setting up the server with Server Assistant, when it asks for Primary DNS and computer name. What am I supposed to put in here? I read one post that recommended that quiting the set-up assistant before this point and doing it manually?
    b. Once I get through the assistant and launch Server Admin, and sign into it using the servers local IP, get into DNS and go to add zones, I am REALLY CONFUSED.
    - I add my primary zone, What is the primary zone? What do I enter here? What about the name server? I do not understand the difference between these 2 things.
    c. Then I go to add my A record for the machine. What should its Machine name be? the same as the primary zone?
    What is the easiest way to get through this? I know that once I this is set up and I can get the wiki to work over the WAN that I am not going to have any problems with the rest. I don't even want to bind the computers to the server if I don't have to. I know that for ichat (jabber); afp and ftp that this is not required since every time I have attempted to get the server up these services worked every time without the binding.

Maybe you are looking for

  • EA4500 - not as easy to set up

    Unfortunately the Linksys EA4500 is not as easy to "Set Up & Manage with Ease" as they claim. After trying to connect my Dell color laser network printer, which was working just fine with the replaced Dlink DIR-655 router, it turns out that the suppl

  • PRODUCT AND SOFTWARE COMPONEBT VERSION

    Hi Gurus, I am using SAP PI 7.0 with SP  . Actually i have to create one product with my own name and one SWCV with name E-FILING GB. But this SWCV already exist in SLD. Now I am uing this SWCV and SAP HR 6.0 in IR by importing it from XI Standard Co

  • Ilustrator CS4+Snow Leopard Profile issues

    Seems like something is not working in Cs4 Illustrator with Snow Leopard. Can someone give it a try to verify. When I print to my Epson 3800 from Illust. It's not matching the same image printed via PS Cs4. ( It should if you follow a controlled work

  • ONS not starting

    Hi, I have Oracle 10.2.0.1 two node RAC running on RHEL 4. Few days back I noticed that the ONS is not showing offline for both the nodes in the target.I tried starting it manuaaly through srvctl,crs_start and onsctl commands but all of them failed t

  • Autocad 2015 Crashing on OSX Yosemite

    I recently upgraded to Apple's new opperating system (OSX Yosemite) and am experiencing random crashes every 5-10 minutes on Autocad 2015 for Mac. The crashes are not associated with any specific command or action but rather the program spontaneously