function post_content($url, $Origin, $Destination, $first_date) { //первый запрос на выборку $uagent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"; $postdata = 'action=avail'; $postdata .= '&p=bti'; $postdata .= '&pos=RU'; $postdata .= '&l=ru'; //$postdata.= '&srcsystem=https%3A%2F%2Fwww.airbaltic.com%2Fru%2Findex'; $postdata .= '&traveltype=bti'; $postdata .= '&origin=' . $Origin; $postdata .= '&origin_type=A'; $postdata .= '&destin=' . $Destination; $postdata .= '&destin_type=A'; $postdata .= '&numadt=1'; $postdata .= '&numchd=0'; $postdata .= '&numinf=0'; $postdata .= '&bbv=0'; $postdata .= '&flt_origin_text=%D0%9A%D0%B8%D0%B5%D0%B2+%28Boryspol%29+%28KBP%29+-+%D0%A3%D0%BA%D1%80%D0%B0%D0%B8%D0%BD%D0%B0'; $postdata .= '&flt_destin_text=%D0%92%D0%B0%D1%80%D1%88%D0%B0%D0%B2%D0%B0+%28Frederic+Chopin%29+%28WAW%29+-+%D0%9F%D0%BE%D0%BB%D1%8C%D1%88%D0%B0'; $postdata .= '&legs=1'; $postdata .= '&flt_leaving_on=' . $first_date; $postdata .= '&flt_returning_on=' . $first_date; $postdata .= '&evoucher%5B%5D='; $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); //curl_setopt($ch, CURLOPT_PROXY, "104.202.117.242:80"); // curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($ch, CURLOPT_USERAGENT, $uagent); curl_setopt($ch, CURLOPT_TIMEOUT, 180); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); curl_setopt($ch, CURLOPT_COOKIEJAR, "dcoo.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "dcoo.txt"); $content = curl_exec($ch); //echo $content; $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //echo $code; if ($code == 301 || $code == 302) { preg_match('/Location:(.*?)\n/', $content, $matches); $newurl = trim(array_pop($matches)); curl_close($ch); return post_content($newurl, $Origin, $Destination, $first_date); } else { curl_close($ch); //echo $content; return $content; } }
$postdata = 'D_City=' . $Origin; $postdata .= '&A_City=' . $Destination; $postdata .= '&D_SelectedDay=' . $D_Day; $postdata .= '&D_Day=' . $D_Day; $postdata .= '&D_Month=' . $D_Month; $postdata .= '&R_SelectedDay=' . $R_Day; $postdata .= '&R_Day=' . $R_Day; $postdata .= '&R_Month=' . $R_Month; $postdata .= '&CurrencyCode=USD'; $postdata .= '&TripType=2'; $url .= $postdata; //echo $url."<br>"; //echo "http://www.norwegian.com/us/booking/flight-tickets/farecalendar/?D_City=AAL&A_City=AGA&D_SelectedDay=01&D_Day=01&D_Month=201601&R_SelectedDay=01&R_Day=01&R_Month=201601&CurrencyCode=USD&TripType=2"; $html[] = post_content($url); //echo $html[0]; $html[0] = str_get_html($html[0]); //print_r($html); foreach ($html as $html_content) { #ctl01_ctl00_MainContentRegion_MainRegion_ctl00_ipcFareCalendarResultOutbound_pnlFareCalendarResult $html_content_out = $html_content->find('#ctl01_ctl00_MainContentRegion_MainRegion_ctl00_ipcFareCalendarResultOutbound_pnlFareCalendarResult', 0); $html_content_in = $html_content->find('#ctl01_ctl00_MainContentRegion_MainRegion_ctl00_ipcFareCalendarResultInbound_pnlFareCalendarResult', 0); //echo $html_content_in for ($i = 0; $i < 30; $i++) { if (!empty($html_content_out->find('div.fareCalPrice', $i)->innertext) && (($html_content_out->find('div.fareCalPrice', $i)->innertext) != ' ')) {
<?php theme_header(); ?> <article> <header> <h1><?php post_title(); ?> </h1> </header> <?php post_content(); ?> </article> <?php theme_sidebar(); ?> <?php theme_footer();
/** * Displays the content of the current post. * * * @since 0.1 */ function post_excerpt($text = '') { global $post; if (empty($text)) { $text = 'Weiterlesen'; } if (is_array($post) && array_key_exists('excerpt', $post)) { $markdownExtra = new ParsedownExtra(); $file_content = substr($markdownExtra->text($post['excerpt']), 0, -4) . ' <a class="more" href="archiv/' . $post['file_name'] . '/" title="">' . $text . '</a></p>'; echo $file_content; } else { post_content(); } }
$postdata .= 'TXT_SURNAME_baggage=&'; $postdata .= 'TXT_PNR_NO_s=&'; $postdata .= 'TXT_SURNAME_s=&'; $postdata .= 'TXT_PNR_NO=&'; $postdata .= 'TXT_SURNAME=&'; $postdata .= 'TXT_PNR_NO_insurance=&'; $postdata .= 'TXT_SURNAME_insurance=&'; $postdata .= 'TXT_PNR_NO_sports=&'; $postdata .= 'TXT_SURNAME_sports=&'; $postdata .= '__VIEWSTATEGENERATOR=967A6D11'; //echo $postdata.'<br>'; //echo $date_dep.'<br>'; $html[] = post_content('https://book.flypgs.com/Common/MemberRezvResultsPreview.jsp?activeLanguage=RU', $postdata); foreach ($html as $html_content) { for ($i = 0; $i < 14; $i++) { $first_date = DateTime::createFromFormat('d/m/Y', $first_date); $first_date->modify('+1 day'); $first_date = $first_date->format('d/m/Y'); if (!empty($html_content->find('div.#containerDep span.price', $i)->innertext)) { $price = $html_content->find('div.#containerDep span.price', $i)->innertext; $preprice = trim(str_replace(array("\r\n", "\r", "\n"), " ", $price)); preg_match('/^(.*)\<sup\>/', $preprice, $price_out); $fly_out [$first_date] = $price_out[1];
<span><?php _e('Category'); ?> :<?php post_category(','); ?> </span> <a href="<?php post_link(); ?> #comments"><?php post_comment('No Comments', '1 Comment', '%d Comments'); ?> </a> </p> <?php post_content(500); ?> </div> <?php } ?> <?php post_nav(); ?> </div><!-- end #content--> <?php display('inc/sidebar.php'); display('inc/footer.php');
if ($period < ((strtotime($datetime->format('Y-m-d')) - strtotime($search_date)) / 86400)) { break; } else { $html = nexdate(); } unset($datetime); //+1 den } while (true); unset($html); unset($html_out); //Парсим обратные рейсы $first_date = $_POST['first_date']; $html = post_content($url, $Destination, $Origin, $first_date); do { $html = str_get_html($html); //$html_in = $html->find('div[id=marketColumn0]', 0)->find('.flights-body', 0); if(is_object($html->find('div[id=marketColumn0]'))){ echo "Рейсы отсутствуют"; break 1; }else{ $html_in = $html->find('div[id=marketColumn0]', 0)->find('.flights-body', 0); } unset($html);
function sendsms2 ($type,$phone,$param1='',$param2='',$param3='',$param4='') { global $arraytextsms,$sender_idsms,$loginsms,$passwordsms,$transactionsms; $transactionId = "12345667a"; if ($param1 == '' || !$phone) return false; $ttt = isphone($phone); if ($ttt === false) return false; if ($type==0) $sms_text = $param1; elseif ($arraytextsms[$type]) { $sms_text = str_replace("___1___",$param1,$arraytextsms[$type]); $sms_text = str_replace("___2___",$param2,$sms_text); $sms_text = str_replace("___3___",$param3,$sms_text); $sms_text = str_replace("___4___",$param4,$sms_text); } else return false; $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>". "<message>". "<login>" . $loginsms . "</login>". "<pwd>" . $passwordsms . "</pwd>". "<id>" . $transactionsms . "</id>". "<sender>" . $sender_idsms . "</sender>". "<text>" . strtolower_rusms($sms_text) . "</text>". // "<time>20101118214600</time>". // Можно указать время отправки этого сообщения "<phones>". "<phone>" . $ttt . "</phone>". // "<phone>79091234567</phone>". // Можно указать дополнительные номера телефонов "</phones>". // "<test>1</test>". // Если раскомментировать эту строку, то СМС не будет отправлено фактически и не будет протарифицированно "</message>"; //echo htmlspecialchars($xml); try { $url = "http://2kengu.ru/api/message"; $result = post_content( $url, $xml ); $html = $result['content']; $patern="#<[\s]*status[\s]*>([^<]*)<[\s]*/status[\s]*>#i"; preg_match($patern, $html, $matches); $status = $matches[1]; //echo htmlspecialchars($html); if ($status == '0' || $status == '11') return array(0=>$status,1=>$ttt,2=>strtolower_rusms($sms_text)); else return $status; } catch(Exception $e) { return false; } }