http-get

Using HttpGet returning complete HTML code

雨燕双飞 提交于 2019-12-01 12:36:54
I am trying to invoke a private web-service in which there's one link I've to access using GET method. While using the direct URL on browser (needs to login first), I get the data in JSON format. The URL I am invoking is like this http://www.example.com/trip/details/860720?format=json The url is working fine, but when I invoke this using HttpGet , I am getting the HTML coding of the webpage, instead of the JSON String. The code I am using is as follows: private String runURL(String src,int id) { //src="http://www.example.com/trip/details/" HttpClient httpclient = new DefaultHttpClient();

HTTP Get: Only download the header? (HEAD is not supported)

匆匆过客 提交于 2019-12-01 03:38:41
In my code I use some Http Get request to download some files as a stream. I use the following code: public String getClassName(String url) throws ClientProtocolException, IOException { HttpResponse response = sendGetRequestJsonText(url); Header[] all = response.getAllHeaders(); for (Header h : all) { System.out.println(h.getName() + ": " + h.getValue()); } Header[] headers = response.getHeaders("Content-Disposition"); InputStreamParser.convertStreamToString(response.getEntity().getContent()); String result = ""; for (Header header : headers) { result = header.getValue(); } return result

What is the default behaviour of a controller action not marked with AcceptVerbs, HttpGet or HttpPost?

◇◆丶佛笑我妖孽 提交于 2019-12-01 03:21:49
If I create a controller action and do not decorate it with AcceptVerbs , HttpPost or HttpGet . What is the default behaviour? Does the action allow any access method or does it default to GET ? It's accessible via any verb. In Web API 2.1: it depends on the name of the action. If the action starts with "Get*" then it will default to only accept GET requests. If it starts with "Put*" then it will default to only accept PUT requests. Same with POST. If it doesn't start with any known verb then it will default to only accept POST. Here are the results of my testing: public class BlahController :

Using grequests to make several thousand get requests to sourceforge, get “Max retries exceeded with url”

对着背影说爱祢 提交于 2019-12-01 02:13:14
I am very new to all of this; I need to obtain data on several thousand sourceforge projects for a paper I am writing. The data is all freely available in json format at the url http://sourceforge.net/api/project/name/[project name]/json. I have a list of several thousand of these URL's and I am using the following code. import grequests rs = (grequests.get(u) for u in ulist) answers = grequests.map(rs) Using this code I am able to obtain the data for any 200 or so projects I like, i.e. rs = (grequests.get(u) for u in ulist[0:199]) works, but as soon as I go over that, all attempts are met

HTTP Get: Only download the header? (HEAD is not supported)

余生颓废 提交于 2019-12-01 00:49:44
问题 In my code I use some Http Get request to download some files as a stream. I use the following code: public String getClassName(String url) throws ClientProtocolException, IOException { HttpResponse response = sendGetRequestJsonText(url); Header[] all = response.getAllHeaders(); for (Header h : all) { System.out.println(h.getName() + ": " + h.getValue()); } Header[] headers = response.getHeaders("Content-Disposition"); InputStreamParser.convertStreamToString(response.getEntity().getContent())

How to call a website service from PHP?

折月煮酒 提交于 2019-11-30 21:13:36
问题 My problem is the following, I have an EmailReports.php on my server which I use to send mails like EmailReports.php?who=some@gmail.com&what=123456.pdf I can NOT modify EmailReports.php since that belongs to a diferent project and it instantly sends an email and has been aproved by QA team and all that stuff. Now, on a diferent LookReports.php I need to offer a service like "Send me the reports I reviewed" which manually can be easily executed as just calling EmailReports.php, the question is

How to call Firebase Callable Functions with HTTP?

大憨熊 提交于 2019-11-30 17:47:12
I realised that the new Callable Cloud Functions can still be called as if they were HTTP events , i.e. they can still be reached under http://us-central1-$projectname.cloudfunctions.net/$functionname . When doing that I receive an error message in my Cloud Functions Log : Request has invalid method. GET This means that HTTP-GET does not work, but is there a way to call the functions? Maybe they are using HTTP-CONNECT . bklimt EDIT: The details of the protocol have been formally documented now. HTTPS Callable functions must be called using the POST method, the Content-Type must be application

android httpclient and utf-8

心已入冬 提交于 2019-11-30 07:46:54
I'm trying to connect to a webservice where my querysting holds some data. The bad thing is that this data contains utf-8 charcters, which renders a problem. If I simply call HttpGet with the ordinary string I get the "illegal character" exception. So I googled and tried some utf-8 magic. HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter("http.protocol.content-charset", "UTF-8"); String utfurl = URLEncoder.encode(url, "utf-8"); HttpGet httpGet = new HttpGet(utfurl); HttpResponse response = httpclient.execute(httpGet); content = response.getEntity().getContent

How to follow a redirect in http.get in AngularJS?

ぃ、小莉子 提交于 2019-11-30 05:13:34
I am working on a website for coaches to help people have healthier lives by using social media. On the moment I am working on access to Twitter through OAuth in a ExpressJS server with AngularJS in the frontend. From the website of AngularJS : A response status code between 200 and 299 is considered a success status and will result in the success callback being called. Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning that the error callback will not be called for such responses. The full code of my server can be found in web.js and twitter.js on

How to call Firebase Callable Functions with HTTP?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 01:54:42
问题 I realised that the new Callable Cloud Functions can still be called as if they were HTTP events, i.e. they can still be reached under http://us-central1-$projectname.cloudfunctions.net/$functionname . When doing that I receive an error message in my Cloud Functions Log : Request has invalid method. GET This means that HTTP-GET does not work, but is there a way to call the functions? Maybe they are using HTTP-CONNECT . 回答1: EDIT: The details of the protocol have been formally documented now.