0

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

1
  • 2
    You can get the reversed by using "curl --libcurl example.c [the rest]" to see what libcurl options certain command line options make. That might be a bit helpful at least. Commented Jan 5, 2016 at 10:27

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.