PHP proxy server working half of the time
I know nex开发者_运维知识库t to nothing about PHP. I'm trying to give away a set of financial calculators that rely on web service which is accessed via either a .NET proxy or PHP proxy. I've in stalled the PHP proxy on 3 different servers (windows and linux) and the setup always works for me. Yet, I have webmaster write and they can't get it to run.
I was hoping someone with debugging experice can give these a try:
http://www.pine-grove.com/online-calculators/pgs-html-calculators.htm
Here's more background to save you some time.
There an install PDF included. But basically unzip in a folder. Suggest "calculators". Locate js/calculator.js. At about row 11, edit this line to point to the proxy that is installed:
var strWebService = 'http://{www.your-server.com}/Calculators/proxies/calculators.php';
That's all that should be required. The HTTPRequest object's responseText field contains this error:
soap:ReceiverServer was unable to process request. ---> '\' is an unexpected token. The expected token is '"' or '''. Line 1, position 15.**
This seems to be working for most people, but for a handfull, it doesn't. thanks in advance and I hope someone can shed some light on this problem.
A few things:
curl_setopt($ch, CURLOPT_HEADER, 1);
is probably not what you want. This causes the response headers to be included as text at the head of$result
. Byecho
ing them back, they do not magically become response headers of the request tocalculator.php
; they are part of the body of the response.- A four second timeout is probably too small. If it works for you, but not the webmaster, then I'm guessing that the CURL request performed by
calculator.php
timed out for the webmaster and a warning stating this fact was sent back. These look wrong:
$header[] = "Content-Type: text/xml; charset=utf-8"; $header[] = 'http://com.pine-grove/' + $wsMethod;
Get rid of the PHP close tag
?>
at the end. It's generally not needed and you risk sending back extra whitespace, as in this case, wherecalculator.php
is inadvertently appending CR+LF to the bodies of all proxied responses.
精彩评论