0

I am working with a shipping carrier (Estes Express) and integrating their system into my system designed in PHP. I've looked up how PHP curl requests are created; however, I am confused on how to integrate certain features into the CURL request. Below, I am going to paste in how they showed the CURL request. If someone could assist in showing me how to plug the variables into a standard PHP CURL that would be fantastic.

curl -X POST 'https://cloudapi.estes-express.com/v1/api-key'
-H 'accept: application/json'
-u myEstesUsername:myEstesPassword

How do I integrate the -H and -u into a PHP curl format? Any ideas?

dbc
  • 104,963
  • 20
  • 228
  • 340
KDJ0127
  • 11
  • 1
    It's done through [curl_setopt()](https://www.php.net/manual/en/function.curl-setopt.php#refsect1-function.curl-setopt-examples). You know what your curl command does, all you need to do is find equivalent options. You probably want to set `CURLOPT_SSL_VERIFYPEER` to `false` and `CURLOPT_RETURNTRANSFER` to `true`. – KIKO Software Jun 23 '22 at 20:26
  • 1
    See https://incarnate.github.io/curl-to-php/ – Barmar Jun 23 '22 at 20:41
  • Barmer - that is an incredible tool. Can you post that as an answer so that I can accept it. That helps not only in this case but future cases too – KDJ0127 Jun 24 '22 at 13:10
  • Does this answer your question? [Convert command line cURL to PHP cURL](https://stackoverflow.com/questions/1939609/convert-command-line-curl-to-php-curl) – margusl Jun 25 '22 at 09:58

0 Answers0