Jump to content

rahulag38

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rahulag38's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanxs a lot for replying.. The digit in the square bracket has to be "2" and not just ant digit . Also could not understand why have you used "?" . I want the exact pattern match and nothing optional And the pattern would be : "[2] = 'xxxx.xx'" Every thing between double quotes (including the single quote surrounding the digits)
  2. Thanxs a lot for replying.. The digit in the square bracket has to be "2" and not just ant digit . Also could not understand why have you used "?" . I want the exact pattern match and nothing optional
  3. Thanxs a lot.. Also what would be the reg ex for - 1. "[2] = xxxx.xx" 2."[2]=xxxx.xx" i.e everything between the quotes " " including the square brackets ,"=" sign and the digit "2", where X = number between 0-9. The diff btw first and second is that spaces are eliminated
  4. Hello, I need the regular expression for xxxx.xx . The code i am using is showing error. My code: $pattern='^\d{1,4}(\.\d{1,2})?$'; preg_match_all($pattern, $stringss, $matches); The error i am getting: Warning: preg_match_all() [function.preg-match-all]: No ending delimiter '^' found in /home/flightde/public_html/test.php on line 3
  5. Hello, First of all ,I have been a regular reader of the forum and it has increased my knowledge in the PHP a lot. Till now i had just been a guest user and used to go through the queries and tips posted here. Today , for the first time i am posting on the forum Coming to a problem: I have to design a function for a client from travel domain. Where he wants the script/function to go and extract data from an airline website on the available fare for a specific date and destination. The problem is that only a part of fare(Base fare) is visible on the site and you have to select one of the given flight option(s) (after selecting the option through AJAX the full fare is displayed on the same page on the left hand site) to get the complete fare including fare and surcharges. Now i want my function/script to extract the full fare for all the available flight options. I have written the below piece of code. But its not efffective as it gets only the base fare part of the result page and not the complete fare.. The airline booking url is : http://book.spicejet.com/skylights/cgi-bin/skylights.cgi My code: //---- Spicejet start // ENGINE URL http://book.spicejet.com/skylights/cgi-bin/skylights.cgi?page=homecomp //Taking some sample search data - just to test the script $event="search" ; $module="SB" ; $page="SEARCH" ; $mode="empty" ; $travel="1" ; // ONE WAY OR 2 WAY $from1="HYD" ; $to1="DEL" ; $departDay1="13" ; $departDay2=""; $departMonth1="201010" ; $ADULT="1" ; $CHILD="0" ; $INFANT="0" ; $toCity1="DEL" ; $numberMarkets="1" ; // the page needs data in POST form $curlPost = 'event=' . urlencode($event) . '&module=' . urlencode($module) .'&page=' . urlencode($page) .'&mode=' . urlencode($mode) .'&travel=' . urlencode($travel) .'&from1=' . urlencode($from1) .'&to1=' . urlencode($to1) .'&departDay1=' . urlencode($departDay1) .'&departMonth1=' . urlencode($departMonth1) .'&ADULT=' . urlencode($ADULT) .'&CHILD=' . urlencode($CHILD) .'&INFANT=' . urlencode($INFANT) .'&toCity1=' . urlencode($toCity1) .'&numberMarkets=' . urlencode($numberMarkets).'&submitSearch=submitSearch'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://book.spicejet.com/skylights/cgi-bin/skylights.cgi'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost); $data = curl_exec($ch); curl_close($ch); echo($data); Also one more query Is there something like beautiful soup (As in Python) to parse the data. I want to extract the flight timing and total price from the page and insert into a database. Thanxs in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.