10. september 2012 - 09:09 Der er 1 løsning

PayPal Payment Data Transfer (PDT) "Invalid host header" in PayPal sandbox mode.

Payment Data Transfer (PDT) does not work in sandbox mode.  When I expect data from a transaction, hereunder the email of the customer's paypal account, I instead receive the message "Invalid host header."

I understand PDT to work this way:  When a customer has made a payment to my paypal account paypal sends me a token that I must return together with the auth_token from the account.  Paypal then sends me the data from the transaction.

In the program I receive, in both modes, the token correctly, for example 2W04538282383663P. Then I open a connection successfully with
"$fp = fsockopen ($fsock, 443, $errno, $errstr, 30);"
$fsock is ssl://www.sandbox.paypal.com i sandbox mode and ssl://www.paypal.com in live mode.

Then follows
"fputs ($fp, $header . $req);"

The values for $req contains the token I have received and for each of the two modes the auth_token (that I have checked and double checked).  For the rest $req is identical for the two modes.  For example for sandbox $req=

cmd=_notify-synch&tx=2W04538282383663P&at=skNPZNT1DR3rR8sJKm6CytFp0VNGa0J0aXH-QWZ6eFofoc3yu8Zo-WIjeqG

$header is identical for the two modes:

POST /cgi-bin/webscr HTTP/1.0 Content-Type: application/x-www-form-urlencoded Content-Length: 101

Then the programme continues:

while (!feof($fp)) {
$line = fgets ($fp, 1024);
......
}

In sandbox mode the lines received are:
HTTP/1.0 400 Bad Request
Server: BigIP
Connection: close
Content-Length: 19
" "
Invalid Host header

In live mode the first lines received are:
HTTP/1.1 200 OK
Date: Sun, 09 Sep 2012 17:54:00 GMT
......
12. september 2012 - 13:35 #1
Det var der ingen bud på.  Det var skade.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester