IllSc
IllSc

Reputation: 1459

Get cURL command line given PHP cURL code

Given a PHP source code with curl handle, how do I get the command line version of that curl request?

Upvotes: 0

Views: 547

Answers (2)

vr_driver
vr_driver

Reputation: 2085

You could just create a php file with the curl command in it, and then just run the php script from the command line.

hostname$   php curldownload.php

Or, you could have a look here for examples: http://www.thegeekstuff.com/2012/04/curl-examples/

Upvotes: 1

Clay
Clay

Reputation: 4760

Look at the cURL documentation here:

http://curl.haxx.se/docs/manpage.html

or, go to your terminal and type:

man curl

After reading the documentation, you will have to manually find out which commands map to which functions to get the results you want. Unlikely to be any easier way to do this.

A lot of it will be just looking at which of PHP's curl_setopt() parameters map to the matching command line parameters.

Upvotes: 2

Related Questions