http-post

HttpPost not working!

99封情书 提交于 2019-12-06 12:47:55
问题 I am trying to write something to an empty file on my apache server myClient= new DefaultHttpClient(); StringEntity myString = new StringEntity("important message"); HttpPost httpPost = new HttpPost("http://10.0.218.211/myfile"); httpPost.setEntity(myString); HttpResponse response = myClient.execute(httpPost); The reponse returns "HTTP/1.1 200 OK" so it does find the file I tried removing the file and it returned Error 404 I read apache's docs and looks like am doing it right "i think" My

How to upload image in to php server using Multipart

我们两清 提交于 2019-12-06 12:45:50
问题 I have been headache , how to upload image in to server.It is new task for me.but big confusing for me.i searched on stackoverflow and googled. but i getting problems. My intention is Upload photo from sdcard and take photo from camera and upload to server. In ios, this task already done, in ios php get this type of: When posting php side simple hit this information. and Print Like this; $filedata = $_FILES['photos']; $f = fopen(time().".txt",'wb'); fwrite($f, print_r($_REQUEST,true)); fclose

MVC - Don't save null image data if image was not re-uploaded in HTTP post (from SportsStore example)

可紊 提交于 2019-12-06 12:34:29
I have been following the SportsStore example project in Apress Pro ASP.NET MVC 3 Framework book and trying to apply the concepts to my application. One area that is bugging me is that in the sample, I can add an image to a product and it gets saved to the database, but if I edit any given product, without uploading a new image for it, the image data is cleared out. I want to be able to edit a product, but if the image data returned from the HTTP post is null, that I want Entity Framework to keep the exisiting image data (and content type). How can I command EF to not update this image field

Upload image to server with iOS not working

折月煮酒 提交于 2019-12-06 12:23:02
问题 I am trying to upload an image to my php server but it's not working. When I try to upload the file, the screen just freezes (this is expected - I'm using sendSynchronousRequest until I can get this to work) for about a minute and then it returns an empty string as a response. I've been working on this for over a day and can't seem to get it to work. Furthermore, the image never actually uploads to the server (I checked). Thanks in advance! // Uploading the image -(IBAction)uploadImage:(id

Logging in via HttpPost to a website via an application

陌路散爱 提交于 2019-12-06 11:56:15
问题 Hello Stackoverflowers! I have written a relatively simple application that consists of a login text field, a password text field and a login button. My goal is that when the user enters the login information and touches the login button, the application will log the user into the website I have specified and open it up in a different intent or WebView. My current implementation opens a new activity with a WebView and passes in the login information. My code is as follows for the new activity

How do I submit variables from Android Activity to website url?

有些话、适合烂在心里 提交于 2019-12-06 11:47:29
问题 I have an application built that works like a form, it takes four fields and validates the information in order to make sure that no invalid characters are entered. These four fields are stored in variables: Phone Name Email Comments Now I want to submit the form data (whatever is entered into these four fields and stored to the variables) to a url (will use http://www.test.com), but I am not sure how to go about doing this. I think I am looking for something called the HttpURLConnection, but

android: displaying progress dialog when waiting for connection

微笑、不失礼 提交于 2019-12-06 11:39:23
问题 I am trying to add a progress dialog when a new activity is launched that has to wait for a response from the internet. At the moment the screen just goes black while it is waiting. Does any one know where it needs to be placed to work? this progressDialog: ProgressDialog dialog = ProgressDialog.show(SearchActivity.this, "", "Loading. Please wait...", true); dialog.dismiss(); this is in the overlayActivity extends ItemizedOverlay: @Override protected boolean onTap(int index) { final

Sending a HTTP Post from magento 1.6 after customer registration?

拜拜、爱过 提交于 2019-12-06 11:03:33
问题 can anyone point me in the right direction I need to send a HTTP post when a customer registers and or makes a purchase from Magento to a third part server ? It will be the basic information like name, address, postcode , email ect. Not sure where to start ? Many thanks 回答1: $client = new Varien_Http_Client('http://www.example.com/'); $client->setMethod(Varien_Http_Client::POST); $client->setParameterPost('name', $name); $client->setParameterPost('address', $address); //more parameters try{

Login to a site and then POST to a page in it

感情迁移 提交于 2019-12-06 10:44:26
问题 I have to login to a page using three parameters, after that I have to POST two parameters to another page inside the site I've just logged in. So far I've got a cookie with this: curl -c cookie.txt -d "username=username&pwd=pwd&domain=mydomain" http://myurl ...inside of the cookie I have a JSESSION id. I use the cookie as follows: curl -b cookie.txt -d "par=value" http://myurlnumbertwo Problems: even after a POST to the login url I get in the console the HTML code of the login page, does

Sending HTTP Request GET/POST to form with Java?

我怕爱的太早我们不能终老 提交于 2019-12-06 08:02:52
So I have this piece of code, and I got it to work, and now it basically allows me to send http post and get requests to almost any external website I want UNLESS the elements don't contain a name attribute. Here's an example: This is the Java code: public static String sendPostRequest(String url) { StringBuffer sb = null; try { String data = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode("myUserName", "UTF-8") + "&" + URLEncoder.encode("submit", "UTF-8") + "=" + URLEncoder.encode("Submit", "UTF-8"); URL requestUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection)