Search the Community
Showing results for tags 'p3p'.
-
Hello, I'm hoping someone will be able to help with this issue I'm having. I'm a fairly new PHP user so this is a bit outside my abilities. Any assistance would be much appreciated. The Situation: A script hosted on Yahoo Small Business that submits a query to a third-party site and returns shipment tracking data. When I run the script on my local web server, the data is returned correctly. However when I run it from Yahoo hosting environment, no data is returned for the same query parameters. The Response Header: Server:YTS/1.19.11 P3P:policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV" Date:Thu, 15 Nov 2012 13:14:05 GMT Content-Type:text/html Connection:close Age:2 The script provided by Vendor (Full code is attached..) checkstatus.txt <?php // Error reporting (comment out for debug) //error_reporting(E_ALL); //ini_set("display_errors", 1); // Disable all errors and warnings (comment out in debug) error_reporting(0); define("COMPANY_URL", "https://xxxx.xxxxxxx.xxxxx/cargoQuery?"); // Change second argument to company URL define("COMPANY_USERNAME", "xxxxxxxx"); // Change the second argument to company username define("COMPANY_PASSWORD", "xxxxxxxx"); // Change the second argument to company password // --------------------------------- DO NOT EDIT BELOW THIS LINE --------------------------------- function get_request($url) { $context = stream_context_create(array( 'http' => array( 'method' => "GET", 'header' => sprintf("Authorization: Basic %s\r\n", base64_encode(COMPANY_USERNAME . ":" . COMPANY_PASSWORD)) ), )); $response = file_get_contents($url, false, $context); return $response; } $indicators = array('1' => 'Message Content Accepted', '2' => 'Message Content Rejected with comment', '4' => 'Goods Released', '5' => 'Goods required for examination - referred', '8' => 'Goods May Move under Customs transfer, Detain at Destination (CFIA)', '9' => 'Declaration Accepted, Awaiting arrival of goods.', '14' => 'Error message', '23' => 'Authorised to deliver CSA Shipment', '34' => 'Transaction awaiting processing'); $cargoNum = (trim($_GET['cargo']) != "") ? "cargo=" . strtoupper(trim($_GET['cargo'])) : ""; $transNum = (trim($_GET['transaction']) != "") ? "transaction=" .(trim($_GET['transaction'])) : ""; $data = trim(get_request(COMPANY_URL . $cargoNum . $transNum)); ?> ............... <?php if (!empty($data)) { echo "Data returned!"; $doc = new DOMDocument(); $doc->preserveWhiteSpace = FALSE; $doc->loadXML($data); $messages = $doc->getElementsByTagName('rns'); $hasAttributes = FALSE; $duplicates = Array(); foreach ($messages as $rns) { $hasAttributes = TRUE; $releaseDate = $rns->getAttribute('release_date'); if (in_array($releaseDate, $duplicates)) { continue; } array_push($duplicates, $releaseDate); $ind = $rns->getAttribute('processing_ind'); ?> <tr> <td> <div style="color: #2f2f2f;"> <?= $rns->getAttribute('transaction_num') ?> </div> </td> <td> <div style="color: #2f2f2f;"> <?= $rns->getAttribute('cargo_ctl_num') ?> </div> </td> <td> <div style="color: #2f2f2f;"> <?= $releaseDate ?> </div> </td> <td> <div style="color: #2f2f2f;"> <?= $rns->getAttribute('port') ?> </div> </td> <td> <div style="color: #2f2f2f;"> <?= (array_key_exists($ind, $indicators)) ? $indicators[$ind] : $ind ?> </div> </td> </tr> <?php } } if (!$hasAttributes) { ?> <tr> <td colspan="5"> <p><b>No data to display.</b></p> </td> </tr> <?php } ?> ...... The Environment Yahoo is running PHP 5.3.6 My local server: PHP 5.3.1 Apache 2.2.14
- 6 replies
-
- http 200 ok
- p3p
-
(and 1 more)
Tagged with: