http-post

Get data from an internet link in Android

北城余情 提交于 2019-12-04 09:16:51
I am making an application which takes a URL with. *.asp extension and we pass it the required parameters and get some string result using POST method. Any suggestions on how to achieve this? UPDATED: Actually I have a .net link which takes some POST Parameters and gives me a Result. How can I do that in Android? HTTPResponse should do the trick: DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.yoururl.com"); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); <!-- number should be the amount of parameters nameValuePairs.add

Using System.Net.WebClient with HTTPS certificate

馋奶兔 提交于 2019-12-04 09:15:24
问题 In my C# Windows client, I have a POST submission to "the mothership". I want the data in the submits to be secured, of course, so I paid for HostGator to issue me an SSL certificate. I saved off the .CER file, and I'm constructing the request as such: //wrapper for WebClient object to use certificate file class SecureWebClient : WebClient { protected override WebRequest GetWebRequest(Uri address) { HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address); string certPath = @"e:

How to set downtime for any specific nagios host for certain time from commandline through curl?

为君一笑 提交于 2019-12-04 08:41:06
I need to set a schedule downtime for specific nagios host from the commandline by curl..how do I do that? here is something I am already using for service/host notification enable/disable from commandline. curl -d "some input here" url "user:pass" Like way I need to do the thing for schedule downtime.Now the problem is that downtime option takes more options i.e starttime,endtime,comment etc. So how do I get it done by curl from the commandline? curl -d " some key value pair(hostname,servicename" url "username:passowrd" which will do the service/host notification on and off from the

Android: unable to retrieve data from json

孤街浪徒 提交于 2019-12-04 06:41:45
问题 I am getting one id of some event from the previous activity to this activity and passing this id to the url in current activity to get cityname present in that url. My code is.. String s = getIntent().getStringExtra("ar"); try{ HttpPost hpost = new HttpPost("xxxxxxxxxxxxxxxxx/id"); HttpResponse response = login.client.execute(hpost); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); nameValuePairs.add(new BasicNameValuePair("id", s)); hpost.setEntity(new

jQuery Submit Refreshing Page

江枫思渺然 提交于 2019-12-04 06:32:42
The following code is intended to do a purely ajax POST request, instead it seems to do the POST via ajax and then the browser navigates to the response. The HTML... <div id="bin"> <form class="add" method="post" action="/bin/add/"> <p>I'm interested! Save for later.</p> <input type="hidden" name="product_id" value="23423"> <input type="submit" value="Save"> </form> <form style="display:none;" class="remove" method="post" action="/bin/remove/"> <p>I changed my mind--I'm not interested.</p> <input type="hidden" name="product_id" value="23423"> <input type="submit" value="Unsave"> </form> </div>

Upload multiple files using http POST

时光怂恿深爱的人放手 提交于 2019-12-04 06:09:01
I am having a problem uploading files with FTP from my iPhone app. I am sending an HTTP POST request to my webservice with all the necessary parameters. I am sending two files, one is an image, and the second is audio. The image is being uploaded, but the audio isn't. When I trace my web service it only shows the image field as an uploaded file. It's not showing that the audio is also there. My code is: NSString *urlString = [NSString stringWithFormat:ADD_LEAD_API_URL]; NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]]; // change type to

AFNetworking 3 x-www-form-urlencoded post data

空扰寡人 提交于 2019-12-04 05:12:28
I'm trying to post data with x-www-form-urlencoded body. Posting via postman, it is ok But i cant do it via afnetworking 3. Here is my code NSDictionary *parameters = @{@"login" : email, @"password": password}; NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error]; NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; self.requestSerializer = [AFJSONRequestSerializer serializer]; NSString *urlString = [NSString stringWithFormat:@"%@/%@", HTTPBaseRequestURL, appendLoginUrl]; NSLog(@"URL %@

Json not working with HttpPost probably around setEntity

做~自己de王妃 提交于 2019-12-04 04:01:01
问题 I am using this code to send this to my php file. The file looks what is coming like this. file_put_contents('dump.txt', "POST: \n" . print_r($_POST, true) . "\n\n\n GET: \n" . print_r($_GET, true)); I am sending the json like this: public void postData(String url,JSONObject json) { HttpClient httpclient = new DefaultHttpClient(); String object = "?data=" +json.toString(); System.out.println("object:" + object); try { HttpPost httppost = new HttpPost(url.toString()); httppost.setHeader(

Express post request gives ERR_EMPTY_RESPONSE

荒凉一梦 提交于 2019-12-04 03:40:08
问题 I'm building a node.js and express.js web app and it doesn't works as expected when a post request takes longer than 2 mins. What happens is that after 2 mins my express route is re-called and then, after another 2 mins (4 mins in total) I get this error in the network tab for that post request: net::ERR_EMPTY_RESPONSE I read that express has a default timeout set to 2 mins, but that applies only to get requests... This is my route: const router = express.Router(); router.post('/',

Getting form data from HttpListenerRequest

a 夏天 提交于 2019-12-04 01:26:08
I have a HttpListenerRequest which was initiated from a html <form> that was posted. I need to know how to get the posted form values + the uploaded files. Does anyone know of an example to save me the time doing it for myself? I've had a google around but not found anything of use. The main thing to understand is that HttpListener is a low level tool to work with http requests. All post data is in HttpListenerRequest.InputStream stream. Suppose we have a form like that: <form method=\"post\" enctype=\"multipart/form-data\"><input id=\"fileUp\" name=\"fileUpload\" type=\"file\" /><input type=\