http-post

Is there a size or term limit for a Solr query string when using HTTP POST?

十年热恋 提交于 2019-11-30 17:51:37
I'm using Java to query a Solr server for results that have IDs within a set of known IDs that I am interested in. The best way I could think to get just these results that I am interested in was to create a long query string that looks something like this: q=(item_id:XXX33-3333 OR item_id:YYY42-3445 OR item_id:JFDE-3838) I generate this String, queryString , before making my request, and there are over 1500 such ids included in the request I would eventually like to make. I am using an HTTP POST to make the query as such: HttpPost post = new HttpPost(url); post.setHeader("Content-Type",

How can I send JSON data to server

扶醉桌前 提交于 2019-11-30 17:27:44
Well, here is the story: I have some data need to send to server, but they should turned into JSON dataType first. I made such ajax call: $.ajax({ url: url, // the url I want to post to. type: 'POST', contenttype:'application/json; charset=utf-8', beforeSend: //some HTTP basic auth stuff data: { name:'test', key:'foo', key2:'bar' }, dataType:'JSON' }); basically I'm expecting the data I send to server was: [name:test,key:foo,key2:bar] but what I've got was: name=test&key=foo&key2=bar What did I missing? How can I get those data into JSON? var data = {'bob':'foo','paul':'dog'}; $.ajax({ url:

Android: Sending file to server : PHP receive that file in server

▼魔方 西西 提交于 2019-11-30 16:45:58
In my application i have to send the csv file to server i tried the following code HttpPost httppost = new HttpPost(url); InputStreamEntity reqEntity = new InputStreamEntity( new FileInputStream(file), -1); reqEntity.setContentType("binary/octet-stream"); reqEntity.setChunked(true); // Send in multiple parts if needed httppost.setEntity(reqEntity); HttpResponse response = httpclient.execute(httppost); and my php code is.. <?php if ($_FILES["detection"]["error"] > 0) { echo "Return Code: " . $_FILES["detection"]["error"] . "<br>"; } else { if (file_exists($_FILES["detection"]["name"])) { echo $

Correct way to POST JSON data from Android to PHP

泪湿孤枕 提交于 2019-11-30 16:38:15
I have seen many tutorials and questions using the following method to send JSON object to PHP from Android. For example this wordpress blog , this codeproject tutorial and some answers on stackoverflow like these . All of these tutorials and answers use HTTP header to send data(body) to PHP like this. .... // Post the data: httppost.setHeader("json",json.toString()); .... As a programmer we all know that headers are not meant to carry data(body) . Headers should only carry metadata. So, is there a correct way to send JSON data to PHP from Android which does not involve setting data in header?

How can I send JSON data to server

我的未来我决定 提交于 2019-11-30 16:29:27
问题 Well, here is the story: I have some data need to send to server, but they should turned into JSON dataType first. I made such ajax call: $.ajax({ url: url, // the url I want to post to. type: 'POST', contenttype:'application/json; charset=utf-8', beforeSend: //some HTTP basic auth stuff data: { name:'test', key:'foo', key2:'bar' }, dataType:'JSON' }); basically I'm expecting the data I send to server was: [name:test,key:foo,key2:bar] but what I've got was: name=test&key=foo&key2=bar What did

Correct way to POST JSON data from Android to PHP

雨燕双飞 提交于 2019-11-30 16:17:38
问题 I have seen many tutorials and questions using the following method to send JSON object to PHP from Android. For example this wordpress blog, this codeproject tutorial and some answers on stackoverflow like these. All of these tutorials and answers use HTTP header to send data(body) to PHP like this. .... // Post the data: httppost.setHeader("json",json.toString()); .... As a programmer we all know that headers are not meant to carry data(body) . Headers should only carry metadata. So, is

OAuth 2.0 in php using curl

寵の児 提交于 2019-11-30 15:42:37
问题 I need to get my access_token and refresh_token for OAuth 2.0 to Access Google APIs, the php script below should return a json with access_token, refresh_token like this: { "access_token" : "####", "token_type" : "Bearer", "expires_in" : 3600, "refresh_token" : "####" } but, the php script return me only this error message: { "error" : "invalid_request", "error_description" : "Client must specify either client_id or client_assertion, not both" } I tried to remove client_secret/client_id and

OAuth 2.0 in php using curl

隐身守侯 提交于 2019-11-30 15:33:04
I need to get my access_token and refresh_token for OAuth 2.0 to Access Google APIs, the php script below should return a json with access_token, refresh_token like this: { "access_token" : "####", "token_type" : "Bearer", "expires_in" : 3600, "refresh_token" : "####" } but, the php script return me only this error message: { "error" : "invalid_request", "error_description" : "Client must specify either client_id or client_assertion, not both" } I tried to remove client_secret/client_id and use only client_id/client_secret, but still get the same error. PHP script $client_id = '###.apps

Setting request cookies angular2 http post request

▼魔方 西西 提交于 2019-11-30 15:18:21
问题 I have a login service that performs an http request (to a php backend server) and returns a cookie. After login this cookie is needs to be used in all further requests done by the client. loginservice: login(userCredentials:UserCredentials):Observable<any> { this.request.ServiceType = "Connect" this.request.SessionId = "sessionlessrequest" this.request.Compression = "no" this.request.Parameters = userCredentials; let jsonRequest = JSON.stringify(this.request) return this.http.post("http:/

How to deal with timed out POST requests

百般思念 提交于 2019-11-30 14:59:12
问题 In a RESTful SOA, suppose I issue a POST request via AJAX but I don't get a response before the request times out. Further suppose a re-submission of the request would be harmful. POST is not idempotent. For example, maybe I am posting a bank transfer of money. If I don't get a response, I don't know if the server processed the request. What is the best practice to deal with this, assuming I have control over the client-side and the services side? My initial thought is to include a nonce (i.e