Note that there are some explanatory texts on larger screens.

plurals
  1. POPayPal SSL error on live site
    primarykey
    data
    text
    <p>My PayPal code was working fine on the Sandbox, but when I switched it to live I got errors.</p> <pre><code>function validate_send() { // https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/ipn-codesamples-pop-outside#php // http://stackoverflow.com/questions/3414479 global $system; switch ($system-&gt;config['shop/mode']) { case 'live': $mode = 'www.paypal.com'; break; case 'test': $mode = 'www.sandbox.paypal.com'; break; default: trigger_error('Something\'s gone wrong!'); break; } // Read the post from PayPal and add 'cmd'. $reply = array_merge(array('cmd' =&gt; '_notify-validate'), $_POST); $req = ''; foreach ($reply as $k =&gt; $v) { if ($req) $req .= '&amp;'; $req .= $k . '=' . urlencode($v); } // Post back to PayPal to validate. $header = 'POST /cgi-bin/webscr HTTP/1.0' . CR; $header .= 'Content-Type: application/x-www-form-urlencoded' . CR; $header .= 'Content-Length: ' . strlen($req) . CR . CR; $fp = fsockopen('ssl://' . $mode, 443, $errno, $errstr, 30); if (!$fp) { trigger_error('PayPal HTTP error'); } else { fputs($fp, $header . $req); // Test the HTTP response code. $status = fgets($fp, 1024); $status = trim(substr($status, 9, 4)); if ($status != 200) { return trigger_error('PayPal HTTP error: HTTP status code: ' . $status); } // Loop through response line by line, looking for response. while (!feof($fp)) { $res = fgets($fp, 1024); if (strcmp ($res, 'VERIFIED') == 0) { // Note: Checks mentioned in sample code are performed in the class Cart_External_PayPal_WebsitePaymentsStandard. return true; } elseif (strcmp ($res, 'INVALID') == 0) { return false; } } } fclose($fp); } </code></pre> <p>The error received was <code>fgets(): SSL: fatal protocol error</code> on line 91, which is the first line inside the <code>while (!feof($fp))</code> loop. An error on the line <code>$fp = fsockopen('ssl://' . $mode, 443, $errno, $errstr, 30);</code> would make more sense to me.</p> <p>Either way, it works fine in test mode, but is broken in live mode. What's up with that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload