示例#1
0
 public static function GetRegZavodProgHoriz($zavod_prs, $solsko_leto = '')
 {
     include_once dirname(__FILE__) . '/../CurlTool.php';
     if ($solsko_leto == '') {
         if (date('m') >= 9 && date('m') <= 12) {
             $solsko_leto = date('Y') . '/' . (date('Y') + 1);
         } else {
             $solsko_leto = date('Y') - 1 . '/' . date('Y');
         }
     }
     $debug = true;
     $headers = array('Content-Type: text/xml; charset=utf-8', 'SOAPAction: \'https://paka1.mss.edus.si:443/WebServices/RegZavod/RegZavodServicePort\'');
     $curl = new curlTool(false, false, array(), $headers);
     $xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:si="http://si.edu.mss.si/">' . "\n";
     $xml .= "\t" . '<soapenv:Header/>' . "\n";
     $xml .= "\t" . '<soapenv:Body>' . "\n";
     $xml .= "\t\t" . '<si:getRegZavodProgHoriz>' . "\n";
     $xml .= "\t\t\t" . '<SOLSKO_LETO_NAZIV>' . $solsko_leto . '</SOLSKO_LETO_NAZIV>' . "\n";
     $xml .= "\t\t\t" . '<ZAVOD_PRS>' . $zavod_prs . '</ZAVOD_PRS>' . "\n";
     $xml .= "\t\t" . '</si:getRegZavodProgHoriz>' . "\n";
     $xml .= "\t" . '</soapenv:Body>' . "\n";
     $xml .= '</soapenv:Envelope>';
     // echo 'XML request:', "\n", $xml, "\n\n";
     $result = $curl->fetchContent('https://paka1.mss.edus.si:443/WebServices/RegZavod/RegZavodServicePort', false, $xml);
     // print_r($result . "\n\n");
     $explode = explode('<ns2:getRegZavodProgHorizResponse xmlns:ns2="http://si.edu.mss.si/">', $result);
     $explode = explode('</ns2:getRegZavodProgHorizResponse>', $explode[1]);
     $result = '<document>' . $explode[0] . '</document>';
     libxml_use_internal_errors(true);
     $doc = simplexml_load_string($result);
     $doc = json_decode(json_encode($doc), true);
     $result = $doc['return'];
     $curl->cleanup();
     return $result;
 }