I'm connecting to Authorize.net to set up CIM (customer information manager) accounts for customers. I've had 54 successful and 2 failures in the past month.

Does "connection reset by peer" mean something happened on the other end (the Authorize.net end)?

Is fsockopen buggy - should I use curl instead (assuming I can)?

  • Bob

Edit: I also got an error "failed to enable crypto" caused by the same attempt to fsockopen.

    they look like temporary\transitory errors, i would make a 2nd\3rd attempt if i got an error, maybe sleep a few seconds between each try.

      I believe 'connection reset by peer' means that the remote machine (in this case Authorize.net) has closed your connection. It could happen for a variety of reasons:
      other server too busy
      network congestion causing a timeout
      * ordinary behavior results in the socket closing and you keep trying to write or read to/from it.

      Using fsockopen to connect to sounds like a real chore to me because fsockopen is a really low-level function which has no understanding of what kind of protocol might be expected by the server on the other end of the socket. There's usually a lot of handshaking and stuff at the socket level.

      cURL on the other hand understands a variety of protocols. It's quite easy to POST form data to a remote page and return the result in a string. cURL also lets you specify a cookie file or set up a curl_multi_exec situation where you can make dozens (hundreds?) of simultaneous requests. It's much more full featured.

      You might also look around for a PHP/authorize.net framework.

        a month later

        I ended up redoing it with cURL - so far so good. Thanks!

          Write a Reply...