Is it me, or is does Curl have the uggliest and most counterintuitive api I've ever seen?

  • 9
    I think it's you.

    -d -- data
    -H -- header
    -s -- silent

    idk, it all makes sense to me
  • 0
    I'm not using the CLI. I'm using the PHP api (curl_setopt, curl_exec, etc..). I'm just trying to list the files on a remote sftp server, and the api is pure crap. The are just two commands: curl_init, curl_setopt, and curl_exec. But there are hunders of constant for CURLOPT, which motivated my rant.
  • 1
    This is mostly the raw libcurl C api. Most of them seem counterintuitive, but this comes from the reason because of missing object orientation.
  • 0
    @sbiewald curl is an ancient piece of software. I bet it was born as a hack, back in the 90s, one of those hacks that grew and grew, adding options and flags, new protocols and shit, and now we have.. this :(
  • 2
    Using cURL for SFTP?

    Why wouldn't you use ssh2_sftp?

    Although cURL has a fuck tonne of curl_opt's you rarely need more then a handful.
  • 2
    @C0D4 Because I'm stupid and I didn't know about ssh2_sftp :( Thanks, I'll give it a try, you made my day!

    BTW, the curlOpt I was looking for is CURLOPT_DIRLISTONLY. OMG.
  • 6
    @jiffier 😂 rule 1 of php, always ask a php dev.
  • 0
    Curl is fine until you need to send a JSON with multiple layers of escaped quotation marks.
  • 0
    If you wanna see a really bad API, take a look at some banking APIs..
  • 0
    I second your complaint about the PHP API, but as said before, that's an inheritance from C. I would suggest you to edit the initial post and add appropriate tags and clarification. As also said before, the original cURL API is pretty ok.
  • 0
    @C0D4 and rule no 2, never meet, talk or even see that person ever again.
    take it from me
Add Comment