Example #1
0
    $my = new mysql_class();
    $my->ex_sql("select `moghim_code` from agency where en=1", $q);
    foreach ($q as $r) {
        $out[] = $r['moghim_code'];
    }
    return $out;
}
$upghimatArr = loadghimatArr();
$activeAgency = loadActiveAgency();
$today = substr(perToEnNums(jdate('Y/m/d', strtotime(date("Y-m-d H:i:s")))), 2);
//
$onem = substr(perToEnNums(jdate('Y/m/d', strtotime(date("Y-m-d H:i:s", time() + 30 * 24 * 60 * 60)))), 2);
// date("Y-m-d H:i:s",time()+ 30*24*60*60);
$cl = new SoapClient("http://91.98.31.190/Moghim24Scripts/Moghim24Services.svc?wsdl");
$param = array('fd' => $today, 'ld' => $onem, 'cust' => '1010', 'pass' => '123456');
$res = $cl->openTempfllist($param);
$pattern = '/<xs:schema.*<\\/xs:schema>/';
$xml = preg_replace($pattern, '', $res->openTempfllistResult->any);
$response = simplexml_load_string($xml);
$tt = $response->NewDataSet;
$qu = "insert into parvaz_det (`id`, `parvaz_id`, `tarikh`, `saat`, `zarfiat`, `ghimat`, `flnum`, `subflid`, `strsource`, `strdest`, `alname`, `flclass`, `typ`, `saat_kh`, `en`, `customer_id`,selrate,ghimat_origin) values ";
$tmp = '';
$i = 0;
$my->ex_sqlx("truncate table parvaz_det");
foreach ($tt as $val) {
    foreach ($val as $flight) {
        if ((string) $flight->reservable == 'true' && (string) $flight->reservekind == '1' && in_array((string) $flight->AgencyCode, $activeAgency)) {
            $i++;
            $tarikh = hamed_pdateBack((string) $flight->fldate);
            $saat = (string) $flight->outtime;
            $zarfiat = (string) $flight->showcapnet;