raaj
raaj

Reputation: 3291

Curl echo only prints when code ends

Good day,

I am trying to run a php script on cmd using curl (I have installed the windows version of curl). The thing is, all my echo calls print..but only after the script has ended. There is a while loop inside the script and I need to track what it's printing. Is there anyway I can get it to output?

Upvotes: 0

Views: 85

Answers (1)

user1896728
user1896728

Reputation:

The HTTP status code is something along the lines of:

curl -s -o /dev/null -w "%{http_code}" http://www.example.org/

A lot easier to work with in scripts, as it doesn't require any parsing :-)

The parameter -I might be added to improve response load performance. This parameter just request for status/headers of response, without download response body. (%{http_code} returns on first line of HTTP payload)

i.e.:

curl -s -o /dev/null -I -w "%{http_code}" http://www.example.org/

Upvotes: 1

Related Questions