Questions tagged [request]

A request is a message sent by a source to another object.

A request is a message sent by a source (e.g. computer, client, browser ...etc) to another object or device (e.g. server, computer, phone, app ...etc).

src : wikipedia link

15235 questions
1574
votes
8 answers

How are parameters sent in an HTTP POST request?

In an HTTP GET request, parameters are sent as a query string: http://example.com/page?parameter=value&also=another In an HTTP POST request, the parameters are not sent along with the URI. Where are the values? In the request header? In the request…
Camilo Martin
  • 34,128
  • 20
  • 104
  • 150
1002
votes
13 answers

Detecting request type in PHP (GET, POST, PUT or DELETE)

How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?
UnkwnTech
  • 79,308
  • 64
  • 178
  • 223
702
votes
15 answers

How do I send a POST request with PHP?

Actually I want to read the contents that come after the search query, when it is done. The problem is that the URL only accepts POST methods, and it does not take any action with GET method... I have to read all contents with the help of…
Fred Tanrikut
  • 8,681
  • 4
  • 15
  • 7
507
votes
3 answers

Correct way to try/except using Python requests module?

try: r = requests.get(url, params={'s': thing}) except requests.ConnectionError, e: print e #should I also sys.exit(1) after this? Is this correct? Is there a better way to structure this? Will this cover all my bases?
John Smith
  • 9,380
  • 16
  • 43
  • 49
273
votes
12 answers

How can I mock requests and the response?

I am trying to use Pythons mock package to mock Pythons requests module. What are the basic calls to get me working in below scenario? In my views.py, I have a function that makes variety of requests.get() calls with different response each time def…
kk1957
  • 6,308
  • 8
  • 33
  • 57
243
votes
7 answers

How to make a HTTP request using Ruby on Rails?

I would like to take information from another website. Therefore (maybe) I should make a request to that website (in my case a HTTP GET request) and receive the response. How can I make this in Ruby on Rails? If it is possible, is it a correct…
user502052
  • 14,088
  • 30
  • 102
  • 181
196
votes
3 answers

How to use a servlet filter in Java to change an incoming servlet request url?

How can I use a servlet filter to change an incoming servlet request url from http://nm-java.appspot.com/Check_License/Dir_My_App/Dir_ABC/My_Obj_123 to http://nm-java.appspot.com/Check_License?Contact_Id=My_Obj_123 ? Update: according to BalusC's…
Frank
  • 28,342
  • 54
  • 158
  • 227
175
votes
3 answers

Difference between Pragma and Cache-Control headers?

I read about Pragma header on Wikipedia which says: "The Pragma: no-cache header field is an HTTP/1.0 header intended for use in requests. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh…
saplingPro
  • 18,513
  • 51
  • 134
  • 185
174
votes
9 answers

Doing HTTP requests FROM Laravel to an external API

What I want is get an object from an API with a HTTP (eg, jQuery's AJAX) request to an external api. How do I start? I did research on Mr Google but I can't find anything helping. Im starting to wonder is this is even possible? In this post Laravel…
Chilion
  • 3,870
  • 4
  • 30
  • 48
171
votes
6 answers

Pandas read_csv from url

I'm trying to read a csv-file from given URL, using Python 3.x: import pandas as pd import requests url = "https://github.com/cs109/2014_data/blob/master/countries.csv" s = requests.get(url).content c = pd.read_csv(s) I have the following…
venom
  • 1,843
  • 2
  • 9
  • 8
159
votes
4 answers

Javascript : Send JSON Object with Ajax?

Is this possible? xmlHttp.send({ "test" : "1", "test2" : "2", }); Maybe with: a header with content type : application/json?: xmlHttp.setRequestHeader('Content-Type', 'application/json') Otherwise I can…
Adam Halasz
  • 51,803
  • 63
  • 138
  • 208
155
votes
14 answers

Unable to verify leaf signature

I'm using node.js request.js to reach an api. I'm getting this error [Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE] All of my credentials are accurate and valid, and the server's fine. I made the same request with postman. request({ "url":…
ThomasReggi
  • 42,912
  • 63
  • 199
  • 343
153
votes
10 answers

How to send Basic Auth with axios

I'm trying to implement the following code, but something is not working. Here is the code: var session_url = 'http://api_address/api/session_endpoint'; var username = 'user'; var password = 'password'; var credentials =…
Emmanuel
  • 1,867
  • 2
  • 10
  • 15
147
votes
15 answers

Logging raw HTTP request/response in ASP.NET MVC & IIS7

I'm writing a web service (using ASP.NET MVC) and for support purposes we'd like to be able to log the requests and response in as close as possible to the raw, on-the-wire format (i.e including HTTP method, path, all headers, and the body) into a…
Greg Beech
  • 122,952
  • 42
  • 199
  • 241
140
votes
8 answers

POST data with request module on Node.JS

This module is 'request https://github.com/mikeal/request I think i'm following every step but i'm missing an argument.. var request = require('request'); request.post({ url: 'http://localhost/test2.php', body: "mes=heydude" …
Diego Torres
  • 5,028
  • 5
  • 23
  • 29
1
2 3
99 100