| @@ 15-36 (lines=22) @@ | ||
| 12 | private $settings = array(); |
|
| 13 | private $timeout = 7; |
|
| 14 | ||
| 15 | public function validate($xml, $xsd){ |
|
| 16 | $result = null; |
|
| 17 | ||
| 18 | try { |
|
| 19 | ||
| 20 | $client = $this->getClient(); |
|
| 21 | $response = $client->request('POST', '/xml/validate', [ |
|
| 22 | 'form_params' => [ |
|
| 23 | 'xml' => urlencode($xml), |
|
| 24 | 'xsd' => urlencode($xsd), |
|
| 25 | 'response-type' => urlencode('txt') |
|
| 26 | ] |
|
| 27 | ]); |
|
| 28 | ||
| 29 | $result = $response->getBody(); |
|
| 30 | ||
| 31 | } catch (\Exception $e) { |
|
| 32 | $result = $e->getMessage(); |
|
| 33 | } |
|
| 34 | ||
| 35 | return $result; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function transformToXml($xml, $xsl, $dest_path){ |
|
| 39 | $result = null; |
|
| @@ 38-60 (lines=23) @@ | ||
| 35 | return $result; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function transformToXml($xml, $xsl, $dest_path){ |
|
| 39 | $result = null; |
|
| 40 | ||
| 41 | try { |
|
| 42 | ||
| 43 | $client = $this->getClient(); |
|
| 44 | $response = $client->request('POST', '/xml/transform/xml', [ |
|
| 45 | 'form_params' => [ |
|
| 46 | 'xml' => urlencode($xml), |
|
| 47 | 'xsl' => urlencode($xsl), |
|
| 48 | 'dest_path' => urlencode($dest_path), |
|
| 49 | 'response-type' => urlencode('txt') |
|
| 50 | ] |
|
| 51 | ]); |
|
| 52 | ||
| 53 | $result = $response->getBody(); |
|
| 54 | ||
| 55 | } catch (\Exception $e) { |
|
| 56 | $result = $e->getMessage(); |
|
| 57 | } |
|
| 58 | ||
| 59 | return $result; |
|
| 60 | } |
|
| 61 | ||
| 62 | public function transformToHtml($xml, $xsl, $dest_path){ |
|
| 63 | $result = null; |
|
| @@ 62-84 (lines=23) @@ | ||
| 59 | return $result; |
|
| 60 | } |
|
| 61 | ||
| 62 | public function transformToHtml($xml, $xsl, $dest_path){ |
|
| 63 | $result = null; |
|
| 64 | ||
| 65 | try { |
|
| 66 | ||
| 67 | $client = $this->getClient(); |
|
| 68 | $response = $client->request('POST', '/xml/transform/html', [ |
|
| 69 | 'form_params' => [ |
|
| 70 | 'xml' => urlencode($xml), |
|
| 71 | 'xsl' => urlencode($xsl), |
|
| 72 | 'dest_path' => urlencode($dest_path), |
|
| 73 | 'response-type' => urlencode('txt') |
|
| 74 | ] |
|
| 75 | ]); |
|
| 76 | ||
| 77 | $result = $response->getBody(); |
|
| 78 | ||
| 79 | } catch (\Exception $e) { |
|
| 80 | $result = $e->getMessage(); |
|
| 81 | } |
|
| 82 | ||
| 83 | return $result; |
|
| 84 | } |
|
| 85 | ||
| 86 | public function setTimeout($timeout){ |
|
| 87 | $this->timeout = $timeout; |
|