Server doesn't send response code

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Apr 29 19:34:55 EDT 2012


Hi Jacque,

Is it possible that you need to urlDecode or unescape the data from stdIn before posting them back to PayPal? Could it be that the data parts in tOrderData need to be urlEncoded? Could there be a problem with the character encoding? I always make sure that I send and receive UTF8.

Have you tried libUrlSetSSLVerification false?

My PHP script contains a "Content-Length" header, which is set to the total length of tOrderData. I'm also using a header "Content-Type: application/x-www-form-urlencoded". I don't see these headers in your script. The libUrlPostFormdata command uses the second header too and that makes me think that it may not be sent automatically with the post command.

I use a socket timeout interval of 30 seconds, yours seems to be 10 seconds (the default).

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

We will have room for new projects after 1 June. Contact me now and be first in line.

On 30 apr 2012, at 01:07, J. Landman Gay wrote:

> I could still use some advice. I know at least a couple people have liburl working with old-style cgis. I'm running rev 3.5 and liburl 1.1.6.
> 
> This script receives and logs all paypal data but hangs, causing the sandbox to think it couldn't find the server:
> 
> #!rev -ui
> 
> on startup
>  if $REQUEST_METHOD = "POST" then
>    start using stack "liburl"
>    read from stdin until empty
>    put it into tOrderData
>    LOG the time && "Received:" && tOrderData
>    put "cmd=_notify-validate&" before tOrderData -- required response
>    put "https://www.sandbox.paypal.com/cgi-bin/webscr" into tPPAddr
>    post tOrderData to tPPAddr
>    if the result <> "" then LOG "Post result:" && the result
>    put it into tResponse -- "VERIFIED" or "INVALID"
>    LOG "Response:" && it
>    stop using stack "liburl"
>  end if
> end startup
> 
> on LOG pData
>  put "paypalLog.txt" into tFile
>  open file tFile for append
>  write pData &cr & cr to file tFile
>  close file tFile
> end LOG
> 
> Five minutes after this is run, an error occurs but no specifics are listed in the server log, only that there was no 500 html file (which is how I know something went wrong.) I'm assuming it's a timeout.
> 
> Very old list messages suggest a socket may be left open. I tried both of these:
> 
>  set the httpHeaders to "Connection: close"  -- before the post command
> 
> and:
> 
>  repeat for each line s in the openSockets -- at the end of the script
>      try
>        close socket s
>      catch tErr
>        LOG tErr
>      end try
>  end repeat
> 
> Both of these cause an unspecified 500 server error. Nothing is logged.
> 
> I also tried changing the https: to plain http:, but I get a 302 redirect and the script stops.
> 
> I know liburl is in use because it's logging some things, like the 302 error, and I also logged the result after putting the stack in use; it was always empty. I don't see a way to get liburl to log to a file, so I don't know where it's going wrong.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com





More information about the use-livecode mailing list