Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57690

Multiple sequential http requests without closing connection

How can I send multiple http requests sequentially to a server ? I want to send a GET request to an api GET /api/parameter and dont want to send Connection: Close. Then upon receiving the response I want to send another request?

How can I do it with curl?

Upvotes: 3

Views: 2024

Answers (3)

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57690

I have found this. Curl automatically utilizes previous opened connection. Just make sure that you dont create a new handle.

Upvotes: 3

Luc Laverdure
Luc Laverdure

Reputation: 1480

See curl_multi_exec:

http://ca.php.net/manual/en/function.curl-multi-exec.php

Hope this helps.

Upvotes: 0

jman
jman

Reputation: 11626

You need to use HTTP 1.1 like this or the server will close the connection anyway:

GET /api/parameter HTTP/1.1

Upvotes: 0

Related Questions