http-get

OS X: equivalent of Linux's wget

早过忘川 提交于 2019-11-29 18:35:09
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, awaiting response... 200 Script output follows Length: unspecified [text/html] Saving to: `index.html

Get xml from a php webservice url using android

百般思念 提交于 2019-11-29 16:43:35
I want to read a xml from a service url, I wrote the code, my url is ok, seen from browser, public String getXML(){ String line = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpPost = new HttpGet("http://localhost/simplewebservice/index.php?user=1"); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); line = EntityUtils.toString(httpEntity); } catch (Exception ex) { Log.d("Error reading xml", ex.toString()); } return line; } But it gives me the following error java.net.SocketException: Permission denied .

Custom Model Binder for ASP.NET MVC on GET request

混江龙づ霸主 提交于 2019-11-29 16:41:00
问题 I've created a custom MVC Model Binder which gets called for every HttpPost that comes into the server. But does not get called for HttpGet requests. Should my custom model binder get called during a GET ? If so, what did I miss? If not, How can I write custom code handling the QueryString from a GET Request? Here's my implementation... public class CustomModelBinder : DefaultModelBinder { public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext

Array as get parameter in Struts 2

白昼怎懂夜的黑 提交于 2019-11-29 14:12:55
I have an action like below public class CompareAction { private Long[] pids; public Long[] getPids() { return pids; } public void setPids(Long[] pids) { this.pids = pids; } public String displayComparison() { for (Long pid : pids) { System.out.println("pid = " + pid); System.out.println(); } return "success"; } } I'm trying to send an array by typing following url in the addressbar http://localhost:8080/sm-shop/compare?pids=12,23,34 . The output I want is pid = 12 pid = 23 pid = 34 But what I'm getting is pid = 122334 I tried googling but couldn't find how to do this. Please help me figure

HTTP Get in Google Spreadsheet, “e undefined”

寵の児 提交于 2019-11-29 13:04:43
I'm trying to use HTTP Get in Google Spreadsheet, to be able to create a URL to a specific cell in a sheet. I've been searching for how to do it, and I've tried using this way (the GET part), for example. Here's the code I've put together: function doGet(e){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Kunder"); var row = e.parameter["row"]; var col = e.parameter["col"]; var ss = SpreadsheetApp.getActiveSpreadsheet(); var range = sheet.getRange(row, col); SpreadsheetApp.setActiveSheet(sheet); SpreadsheetApp.setActiveRange(range); } And this is an example URL :

AngularJS - $http get returns error with status 0?

心已入冬 提交于 2019-11-29 09:37:34
I've an AngularJS application in which I'm trying to get an XML data with $http get from a server say http://example.com/a/b/c/d/getDetails?fname=abc&lname=def (this when accessed manually by entering the link in a browser shows a tree structure of the XML file). When I run the application the data from that link is not fetched. Instead its showing an error with status 0 . //url = http://example.com/a/b/c/d/getDetails?fname=abc&lname=def $http.get(url).success(function (data){ alert("Success"); deferred.resolve(data); }).error(function (data, status){ console.log("Error status : " + status); }

Add HTTP basic authentication to this HTTP GET in angularjs

前提是你 提交于 2019-11-29 06:41:48
I have an existing angularjs code which makes a HTTP GET. Extracted below is some relevant code inside the controller. .controller('imptViewCtrl', ['$scope', '$http', function ($scope, $http, ) { var url = $configuration.webroot + '/impt/list?list=testlist'; $http.get(url).then(function (response) { tableData = response.data; }); }]); I would like to add HTTP basic authentication to the HTTP GET. The username is foo and the password is bar . How can this be done? Because in basic authentication, the username and password are decode by base64. You need to find a library to do this work for

Authentication Error when using HttpPost with DefaultHttpClient on Android

非 Y 不嫁゛ 提交于 2019-11-29 03:47:50
I'm running into a strange problem using HttpClient. I am using a DefaultHttpClient() with HttpPost. I was using HttpGet with 100% success but now trying to switch to HttpPost as the REST API I'm using wants POST parameters rather than GET. (Only for some API calls though so I know that the GET calls were working fine so it's not a fault of the API). Also, I tried using HttpPost on a simple php script I wrote that looks for a POST parameter 'var' and echoes it to screen, passing this parameters as follows worked fine: List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

Send both POST and GET in a form

烂漫一生 提交于 2019-11-28 23:41:13
I need to make a form send both POST and GET requests (due to some bugs in IE and iframes), how can you do so? The data being sent is nothing mega secure so it doesn't matter if it can be set via GET, just need to make sure it is set both ways. Thanks for the help! Easy: Just specify the GET data in the form URL. <form method="POST" action="form.php?a=1&b=2&c=3"> however, very carefully check how the data is used in the receiving script. Don't use $_REQUEST - rather parse $_GET and $_POST according to your exact needs and in the priority order you need them. Make the form do a usual POST and

How to pass complex object to ASP.NET WebApi GET from jQuery ajax call?

一世执手 提交于 2019-11-28 22:29:47
I have the following complex object in JavaScript which contains filter options var filter={caseIdentifiter:'GFT1',userID:'2'}; which I want to pass to an ASP.NET MVC4 WebApi controller GET [HttpGet] public IEnumerable<JHS.Repository.ViewModels.CaseList> Get([FromBody]Repository.InputModels.CaseListFilter filter) { try { return Case.List(filter); } catch (Exception exc) { //Handle exception here... return null; } } using an jQuery ajax call var request = $.ajax({ url: http://mydomain.com/case, type: 'GET', data: JSON.stringify(filter), contentType: 'application/json; charset=utf-8', cache: