Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Problem with XML sending & receiving from PHP

Sep 16, 2005 4:14AM PDT

Hi.

I have a small PHP function I've written (below) to send XML data to a server,
and receive XML data back. This will be part of a package
that is installed on a website.

It uses fsockopen, fputs and fgets. Which is pretty typical.

Now, that would all be OK, BUT... the application says this:

"You must obtain an SSL package that supports the RSA encryption algorithm
in order to communicate with the server."

I have no clue how to proceed from here.

However, I have a bit of a clue in this paragraph:

"The OnLine Tools currently use certificates from GTE CyberTrust and VeriSign. To obtain the proper certificate, place the XML Tool' s URL in a browser (https://wwwcie.ups.com/ups.app/xml/Rate), connect to the URL, and double-click on the " lock" on the bottom right of the window (using Internet Explorer). After that the steps can be followed to obtain and install the certificate."

But doesn't that install the certificate on my computer?
What good does that do, when I want to install the application
on a website?

I'm lost here. I'd appreciate any help.

Thanks

....Vidya Ishaya


function sendToUPS($host,$path,$data,$useragent=0)
{

$method = 'POST';
$fp = fsockopen($host, 443, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)\n";
return FALSE;
}

fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data) . "\r\n");
if ($useragent) {
fputs($fp, "User-Agent: MSIE\r\n");
}
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);

$gotbuf = FALSE;
while (!feof($fp)) {
$gotbuf = FALSE;
$buf .= fgets($fp,128);
}
fclose($fp);

if( $gotbuf ) return $buf;
echo 'No Data From UPS Server<br>';
return FALSE;
}

Discussion is locked