News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

PayPal Discontinues Support for HTTP 1.0 Protocol Oct. 7, 2013

Started by efocus, July 17, 2013, 21:25:14 PM

Previous topic - Next topic

AH

Alatak

On my test server the updated failed using the code given

the $port in fsockopen for ssl is not 80 but 443

Therefore the code for this should be


$port = 443;
$protocol = 'ssl://';
$header="POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "User-Agent: PHP/" . phpversion () . "\r\n";
$header .= "Referer: " . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . @$_SERVER['QUERY_STRING'] . "\r\n";
$header .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n";
$header .= "Host: "  . $hostname . ":" . $port . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen ($workstring) . "\r\n";

$header .="Connection: close\r\n\r\n";
$fp = fsockopen ( $protocol . $hostname, $port , $errno, $errstr, 30);



I have tested on localhost and will move to live site over the weekend
Regards
A

Joomla 4.4.5
php 8.1

alatak

Hello
Huston,
Yes you are rigth the last line is:
$fp = fsockopen ( $protocol . $hostname, $port , $errno, $errstr, 30)

and not

$fp = fsockopen ( $protocol . $hostname, 80 , $errno, $errstr, 30)

clairemarie

Hi

Sorry to repost my question but I didn't get a reply in my earlier post http://forum.virtuemart.net/index.php?topic=117779.0

I'm using VM 2.0.10

the code in my paypal.php file only has 3 lines

[quote]$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
      $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
      $header .= "Content-Length: " . strlen ($post_msg) . "\r\n\r\n";[/quote]


should I replace these 3 lines with all of this code below:

$header="POST /cgi-bin/webscr HTTP/1.1\r\n";
      $header .= "User-Agent: PHP/" . phpversion () . "\r\n";
      $header .= "Referer: " . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . @$_SERVER['QUERY_STRING'] . "\r\n";
      $header .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n";
      $header .= "Host: "  . $this->_getPaypalUrl ($method) . ":" . $port . "\r\n";
      $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
      $header .= "Content-Length: " . strlen ($post_msg) . "\r\n";
      $header .="Connection: close\r\n\r\n";


Many thanks
Claire

efocus

clairemarie,

You are using an old version of VirtueMart 2 so you may be using a old version of paypal.php as well. Please check line 11 of your paypal.php file as the version we're discussing here for VirtueMart 2.0.22 says:

version $Id: paypal.php 7049 2013-07-02 13:59:39Z alatak

If you're seeing something else, you probably need to update your VM before updating the PayPal code. I would imagine with that much of a change in code that it's probably connected to something else that has changed as well.

A word of warning though — I am sticking with VM 2.0.22a at present because 2.0.22b seems to have broken Gantry for VM pages. I recommend you update VM on your local machine before committing your site online. I'll update after I figure out what the problem is.

clairemarie

Hi

Thanks for the reply.

Yes - I am on an older version:

version $Id: paypal.php 5177 2011-12-28 18:44:10Z alatak

I'm hoping to get updated soon, but if it doesn't happen before the 7th Oct I was hoping this code amendment would see me through.

Firstly I tried updating my paypal plugin with plgvm_virtuemart_paypal_vm2.0.10_1.4.zip from here: http://dev.virtuemart.net/projects/virtuemart/files
but unfortunately when I tested the purchase it didn't confirm.

When I replaced the code in the original file on my test site and made a purchase with my paypal Sandbox - all seemed to be ok - but I thought I should check just in case I may have missed something important.

Thanks
Claire

efocus

Claire,

Since it worked using the sandbox, you're probably fine. However, I'm not a PHP programmer so I couldn't say for sure. Hopefully Alatak will see your post and let you know.

I do know that the 3 lines of code you said were in your version of paypal.php are in the latest version that came with 2.0.22 but they are commented out. That indicates that they were used in the past but replaced with new code. I just don't know if there were any other changes between your version and the most recent one besides the ones specified in this thread.

You could use software like TextWrangler (I'm on a Mac) to compare the paypal.com that came with your VM version and the one that comes with VM version 2.0.22 and see if there are any other differences. If not, I'd say you're probably safe -- but again, I'm not a programmer!

alatak

Hello

I have directly modify  the version which was in the release. Reason why the version number in the file should be the same as the one included in the release.

Humm.. but yes thee was another issue i had fixed concerning the SSL protocol in very old version of paypal.. may be that is the reason
Even if you are using the version 2.0.10, can you try and test this one with both the sandox and the live account, plz
http://dev.virtuemart.net/attachments/download/626/plgvm_virtuemart_paypal_vm2.0.20_1.4.zip

clairemarie

Hi Alatak,

I'm sorry - I tried those files - I get a blank screen after I press the confirm order button.

alatak

Hello
It is probably due to a fatal error
Please set the "Error reporting" to maximum in Joomla. And try again. You will for sure a message displayed.

clairemarie

Hi Alatak,

Here's the message:

Fatal error: Call to undefined method plgVmPaymentPaypal::getEmailCurrency() in mysite/plugins/vmpayment/paypal/paypal.php on line 162

alanbagl;ey

Quote from: clairemarie on September 01, 2013, 10:24:35 AM
Hi

Thanks for the reply.

Yes - I am on an older version:

version $Id: paypal.php 5177 2011-12-28 18:44:10Z alatak

I'm hoping to get updated soon, but if it doesn't happen before the 7th Oct I was hoping this code amendment would see me through.

Firstly I tried updating my paypal plugin with plgvm_virtuemart_paypal_vm2.0.10_1.4.zip from here: http://dev.virtuemart.net/projects/virtuemart/files
but unfortunately when I tested the purchase it didn't confirm.

When I replaced the code in the original file on my test site and made a purchase with my paypal Sandbox - all seemed to be ok - but I thought I should check just in case I may have missed something important.

Thanks
Claire

Hi Claire,

which code did you replace within your paypal.php I have the same version as you and only have the following 3 lines of code:

$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen ($post_msg) . "\r\n\r\n";


Can you post what you got working please?

Thanks
Alan

clairemarie

Hi Alan

I replaced this:

$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
      $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
      $header .= "Content-Length: " . strlen ($post_msg) . "\r\n\r\n";


with this

$header="POST /cgi-bin/webscr HTTP/1.1\r\n";
      $header .= "User-Agent: PHP/" . phpversion () . "\r\n";
      $header .= "Referer: " . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . @$_SERVER['QUERY_STRING'] . "\r\n";
      $header .= "Server: " . $_SERVER['SERVER_SOFTWARE'] . "\r\n";
      $header .= "Host: "  . $this->_getPaypalUrl ($method) . ":" . $port . "\r\n";
      $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
      $header .= "Content-Length: " . strlen ($post_msg) . "\r\n";
      $header .="Connection: close\r\n\r\n";


I have only tested it in my dev site and with my paypal sandbox account so far, and I'm not convinced this is the right way to do it.



alanbagl;ey

Thanks Claire,

Will also test this end. Hopefully alatak or another Developer could confirm that is correct

Thanks again
Alan

alatak

Hello

QuoteFatal error: Call to undefined method plgVmPaymentPaypal::getEmailCurrency() in mysite/plugins/vmpayment/paypal/paypal.php on line 162
OK. The reason is because i asked you to use another version of the paypal plugin.

@ clairemarie
QuoteI'm using VM 2.0.10

Can you please test this version. If everything is ok, i will release it.

[attachment cleanup by admin]

avirammr