|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
- include '../ops_api.php';
-
- if(isset($_GET["doc_ref"])){
-
- $access_token = get_access_token();
-
-
- $ops_url = $_ENV["OPS_URL"] . 'rest-services/published-data/publication/epodoc/' . $document_reference . '/images';
-
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $ops_url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token"));
-
-
- $response = curl_exec($ch);
- curl_close($ch);
-
- if (strpos($response,"No results found") === false ) {
-
-
- $xml = new SimpleXMLElement($response);
-
-
- $drawings_url = $_ENV["OPS_URL_IMAGES"] . '3.2/rest-services/' . $xml->xpath("///ops:document-instance[@desc='Drawing']/@link")[0][0]->__toString() . '?Range=1';
-
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $drawings_url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token"));
-
-
- $response = curl_exec($ch);
- curl_close($ch);
-
-
- header('Content-type: image/jpeg');
- echo $response;
-
- }
-
- }
-
- ?>
|