http-post

Send data to page loaded in WebView

两盒软妹~` 提交于 2019-11-27 22:40:23
问题 I have a WebView in my app and I load http://mysite.com/somepage.php I know I can pass data using the GET method because that would just be right in the URL string. I was wondering how I could pass data to the page using the POST method. I tried searching but I cannot find anything specific. Thanks. 回答1: There's a method called postUrl in WebView . public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); setContentView(webView)

jQuery posts null instead of JSON to ASP.NET Web API

拥有回忆 提交于 2019-11-27 21:22:13
I can't seem to get this to work... I have some jQuery like this on the client: $.ajax({ type: "POST", url: "api/report/reportexists/", data: JSON.stringify({ "report":reportpath }), success: function(exists) { if (exists) { fileExists = true; } else { fileExists = false; } } }); And in my Web.API controller I have a method like this: [HttpPost] public bool ReportExists( [FromBody]string report ) { bool exists = File.Exists(report); return exists; } I'm just checking to see if a file lives on the server, and to return a bool as to whether it does or not. The report string I am sending is a UNC

How should I be implementing the HTTP POST Protocol Binding for SAML WebSSO Profile?

跟風遠走 提交于 2019-11-27 21:03:03
问题 I've implemented my Service Provider and Identify Provider following the SAML Profile for Web SSO using HTTP POST Protocol Binding. However, I am a bit confused as to how the Identity Provider will provide an <AuthnStatement> if the HTTP POST coming from the Service Provider is not tied to a session on the Identity Provider. Could someone enlighten me how one would be able to do this? The other approach I could use is the HTTP Redirect Binding, but that requires User-Agent intervention (i.e.,

jQuery non-AJAX POST

十年热恋 提交于 2019-11-27 20:03:31
Is there a simple non-AJAX POST method in jQuery? I am looking for something equivalent to a form on a page with nothing but hidden fields set via JavaScript which then gets POST-ed, causing the browser to load the page set via action . Just a normal POST, but with values set via jQuery. I suppose I could keep implementing my current method, but I am curious if jQuery provides a quick way. In the background, I imagine it would dynamically create this form with all of the hidden values and submit it. Tidied Darin's excellent solution slightly. function myFunction(action, method, input) { 'use

Launch default browser with intent and post parameters [duplicate]

瘦欲@ 提交于 2019-11-27 19:55:37
Possible Duplicate: How can I open android browser with specified POST parameters? I would like to do something like this: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(" http://www.somepage.com?par1=val1&par2=val2 ")); But I dont want to send the parameters with get but with post. How can I do this as described above? Many thanks in advance, navajo It can be done, but in a tricky way. You can create a little html file with an auto submit form, read it into a string, replace params and embed it in the intent as a data uri instead of a url. There are a couple little negative things, it

how to post plain text to ASP.NET Web API endpoint?

﹥>﹥吖頭↗ 提交于 2019-11-27 19:18:31
I have an ASP.NET Web API endpoint with controller action defined as follows : [HttpPost] public HttpResponseMessage Post([FromBody] object text) If my post request body contains plain text ( i.e. should not be interpreted as json, xml, or any other special format ), then I thought I could just include following header to my request : Content-Type: text/plain However, I receive error : No MediaTypeFormatter is available to read an object of type 'Object' from content with media type 'text/plain'. If I change my controller action method signature to : [HttpPost] public HttpResponseMessage Post(

Read associative array from json in $_POST

筅森魡賤 提交于 2019-11-27 19:07:33
I am using jQuery to post a json object to my php application. jQuery.post("save.php",JSON.stringify(dataToSend), function(data){ alert(data); }); The json string as pulled from firebug looks like this { "data" : [ { "contents" : "This is some content", "selector" : "DIV.subhead" }, { "contents" : "some other content", "selector" : "LI:nth-child(1) A" } ], "page" : "about_us.php" } In php I am trying to turn this into an associative array. My php code so far is <?php $value = json_decode(stripcslashes($_POST)); echo $value['page']; ?> The response to the ajax call should be "about_us.php" but

Go HTTP Post and use Cookies

家住魔仙堡 提交于 2019-11-27 19:06:14
I'm trying to use Go to log into a website and store the cookies for later use. Could you give example code for posting a form, storing the cookies, and accessing another page using the cookies? I think I might need to make a Client to store the cookies, by studying http://gotour.golang.org/src/pkg/net/http/client.go package main import ("net/http" "log" "net/url" ) func Login(user, password string) string { postUrl := "http://www.pge.com/eum/login" // Set up Login values := make(url.Values) values.Set("user", user) values.Set("password", password) // Submit form resp, err := http.PostForm

Passing headers with axios POST request

谁说胖子不能爱 提交于 2019-11-27 18:26:57
I have written an axios POST request as recommended from the npm package documentation like: var data = { 'key1': 'val1', 'key2': 'val2' } axios.post(Helper.getUserAPI(), data) .then((response) => { dispatch({type: FOUND_USER, data: response.data[0]}) }) .catch((error) => { dispatch({type: ERROR_FINDING_USER}) }) And it works, but now I have modified my backend API to accept headers. Content-Type: 'application/json' Authorization: 'JWT fefege...' Now, this request works fine on Postman, but when writing an axios call, I follow this link and can't quite get it to work. I am constantly getting

How to keep HttpClient Connection Keep-Alive?

家住魔仙堡 提交于 2019-11-27 18:11:25
问题 I am working HttpClient POST method. I need to create HttpClient once and should use Keep Alive Connection. But I think in my case , its establishing a new connection every time. So, i need to use a Keep Alive connection for HttpClient . Here is my code snippet any help would be appreciated lot. ClientConnectionManager mgr = httpclient_recv.getConnectionManager(); hp = httpclient_recv.getParams(); httpclient_recv = new DefaultHttpClient( new ThreadSafeClientConnManager(hp,mgr