http-get

How to use HTTP GET in PowerShell? [duplicate]

不打扰是莪最后的温柔 提交于 2019-11-28 21:05:21
Possible Duplicate: Get $webclient.downloadstring to write to text file in Powershell Powershell http post with .cer for auth I have an SMS system that provide me the ability to send SMS from an HTTP GET request: http://smsserver/SNSManager/msgSend.jsp?uid&to=smartsms:*+001XXXXXX&msg="text of the message"&encoding=windows-1255 I want to enter the details to the text from PowerShell and just surf to this URL. How can I do it? Keith Hill In PowerShell v3, have a look at the Invoke-WebRequest and Invoke-RestMethod e.g.: $msg = Read-Host -Prompt "Enter message" $encmsg = [System.Web.HttpUtility]:

How can I use jQuery “load” to perform a GET request with extra parameters?

∥☆過路亽.° 提交于 2019-11-28 18:39:07
I'm reading the jQuery load documentation and it mentions that I can use load to perform a GET request by passing in extra parameters as a string. My current code with my parameters as key/value pair is: $("#output").load( "server_output.html", { year: 2009, country: "Canada" } ); The above works fine but it's a post request. How can I modify the above to perform a GET request while still using load ? According to the documentation you linked: A GET request will be performed by default - but if you pass in any extra parameters in the form of an Object/Map (key/value pairs) then a POST will

How to pass POST parameters in a URL?

独自空忆成欢 提交于 2019-11-28 18:36:30
Basically, I think that I can't, but would be very happy to be proven wrong. I am generating an HTML menu dynamically in PHP, adding one item for each current user, so that I get something like <a href="process_user.php?user=<user>> , but I have a preference for POST over GET. Is there any way to pass the info as a POST parameter, rather than GET from a clickable HREF link? Update: sorry, I am not allowed to use JS - I shoulda said, my bad Update to the update: it looks like @Rob is on to somethign with "You could use a button instead of an anchor and just style the button to look like a link.

What is the difference between [AcceptVerbs(HttpVerbs.Post)] and [HttpPost]?

橙三吉。 提交于 2019-11-28 17:08:23
I can decorate an action either with the [AcceptVerbs(HttpVerbs.Post)]/[AcceptVerbs(HttpVerbs.Get)] [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(string title) { // Do Something... } or with the [HttpPost]/[HttpGet] attributes [HttpPost] public ActionResult Create(string title) { // Do Something... } Are they different? Nothing. One is just shorthand for the other. Rudresha Parameshappa [HttpPost] is shorthand for [AcceptVerbs(HttpVerbs.Post)] . The only difference is that you can't use [HttpGet, HttpPost] (and similar) together on the same action. If you want an action to respond

networkOnMainThread Exception Android

蹲街弑〆低调 提交于 2019-11-28 14:25:19
I'm trying to access a server so I can receive a JSON String. But apparently in Ice Cream Sandwich you can't do network operations in the main thread, but the AsyncTask class is confusing me and not working. Here's what I have so far: //up in main code Void blah = null; URI uri = "kubie.dyndns-home.com/R2Bar2/ingredients.php"; new DownloadFilesTask().execute(uri , blah, blah); private class DownloadFilesTask extends AsyncTask<URI, Void, Void> { protected Void doInBackground(URI... uri) { HttpClient client = new DefaultHttpClient(); String json = ""; int duration = Toast.LENGTH_SHORT; try {

REST API: GET request with body

匆匆过客 提交于 2019-11-28 13:16:47
I want to implement a REST API and need a body on my GET requests. (Like discussed here: HTTP GET with request body ) Are there http clients which are not able to send a body with a GET request? Fiddler is able to do it, although the message box is red. As a general rule, the idea of a GET in REST is that any of your parameters are sent in the URL. As the answer on the question you included indicates, it's doable but misses the point of REST, which is to have a consistent webbish interface. If you want to pass complex data to your endpoint, you probably want to use a POST, which your users

OS X: equivalent of Linux's wget

妖精的绣舞 提交于 2019-11-28 13:09:23
问题 How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different systems which I don't have control on). For example if I start the Mercurial server locally doing a hg serve : ... $ hg serve And then, from a Linux that has the wget command I do a wget: ... $ wget http://127.0.0.1:8000 --2010-12-31 22:18:25-- http://127.0.0.1:8000/ Connecting to 127.0.0.1:8000... connected. HTTP request sent,

Getting URL after a redirect using HttpClient.Execute(HttpGet)

大城市里の小女人 提交于 2019-11-28 12:17:32
I have searched for a while and I am not finding a clear answer. I am trying to log into a webstie. https://hrlink.healthnet.com/ This website redirects to a login page that is not consitent. I have to post my login credentials to the redirected URL. Im am trying to code this in Java but I do not understand how to get the URL from the response. It may look a bit messy but I have it this way while I am testing. HttpGet httpget = new HttpGet("https://hrlink.healthnet.com/"); HttpResponse response = httpclient.execute(httpget);HttpEntity entity = response.getEntity(); String redirectURL = ""; for

pass array of an object to webapi

一笑奈何 提交于 2019-11-28 11:11:23
I have a .net mvc 4 webapi project that I'm trying to pass an array of an object to a method on my controller. I've found some examples here on SO that talk about needing to set my object's properties with: param1=whatever&param2=bling&param3=blah. But I don't see how I can pass in a collection using that. Here is my method signature. Notice I've decorated the argument with the [FromUri] attribute. public List<PhoneResult> GetPhoneNumbersByNumbers([FromUri] PhoneRequest[] id) { List<PhoneResult> prs = new List<PhoneResult>(); foreach (PhoneRequest pr in id) { prs.Add(PhoneNumberBL

How to add query parameters to a HTTP GET request by OkHttp?

送分小仙女□ 提交于 2019-11-28 09:38:45
I am using the latest okhttp version: okhttp-2.3.0.jar How to add query parameters to GET request in okhttp in java ? I found a related question about android, but no answer here! Tim Castelijns As mentioned in the other answer, okhttp v2.4 offers new functionality that does make this possible. See http://square.github.io/okhttp/2.x/okhttp/com/squareup/okhttp/HttpUrl.Builder.html#addQueryParameter-java.lang.String-java.lang.String- This is not possible with the current version of okhttp, there is no method provided that will handle this for you . The next best thing is building an url string