|
Comments for: justin20000428
| Message # 1510087: |
|
Date: 06/27/07 16:12
By: smita Subject: RE: Sending XML request via SSL? any idea on how to send xml request thru SSL and then read the response from that site back?? i have tried this so far: <?php $foo = array(); $foo['top']['TAG'] = 'AccessRequest'; $foo['top']['ATTRIBUTES'] = array ( 'xml:lang' => 'en-US' ); $foo['top']['AccessLicenseNumber']['TAG'] = 'AccessLicenseNumber'; $foo['top']['AccessLicenseNumber']['VALUE'] = '5C0C6CF393A5B540'; $foo['top']['UserId']['TAG'] = 'UserId'; $foo['top']['UserId']['VALUE'] = 'smita_arora'; $foo['top']['Password']['TAG'] = 'Password'; $foo['top']['Password']['VALUE'] = 'c0mputer'; Array_To_XML($foo); $xml = array(); $xml['top']['TAG'] = 'QuantumViewRequest'; $xml['top']['ATTRIBUTES'] = array ( 'xml:lang' => 'en-US' ); $xml['top']['request']['TAG'] = 'Request'; $xml['top']['request']['reference']['TAG'] = 'TransactionReference'; $xml['top']['request']['reference']['context']['TAG'] = 'CustomerContext'; $xml['top']['request']['reference']['context']['VALUE'] = 'smita_arora'; $xml['top']['request']['reference']['version']['TAG'] = 'XpciVersion'; $xml['top']['request']['reference']['version']['VALUE'] = '1.0007'; $xml['top']['request']['action']['TAG'] = 'RequestAction'; $xml['top']['request']['action']['VALUE'] = 'QVEvents'; $xml['top']['request']['Option']['TAG'] = 'RequestOption'; Array_To_XML($xml); $data = http_build_query($foo); echo $data; $context_options = array ( 'http' => array ( 'method' => 'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n", 'content' => $data ) ); $context = stream_context_create($context_options); //echo $context; echo "data sent1"; $data1 = http_build_query($xml); $context_options1 = array ( 'http' => array ( 'method' => 'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data1) . "\r\n", 'content' => $data1 ) ); $context1 = stream_context_create($context_options1); echo "data sent2"; $fp = fopen('https://wwwcie.ups.com/ups.app/xml/QVEvents', 'r', false, $context); $fp1 = fopen('https://wwwcie.ups.com/ups.app/xml/QVEvents', 'r', false, $context1); $url = "https://wwwcie.ups.com/ups.app/xml/QVEvents"; $fp11 = fopen($url, "r"); $fetchedData = fread($fp11,10000000); print_r($fetchedData); |
Previous Message | Next Message |


