Question

This is the usual mile calculator page on emirates website and if i want to access certain fields from DOM of this page by passing certain parameters ,then which library would be required using php and how? I researched the following two libraries : 1.Goutte 2.Simplehtml dom I used both of them and I am only able to search for particular strings and return yes if they exists otherwise no.The link is this one:

http://www.emirates.com/account/english/miles-calculator/miles-calculator.aspx?org=BOM&dest=JFK&trvc=0&h=7b1dc440b5eecbda143bd8e7b9ef53a27e364b

If i wanted to know that "How many mile will I earn from US to India depending on "Class of fare",Ticket type,Skywards tier and Type of fair.Don't provide me code,just guide me how I can load the dom using any existing library and retrieve my queries.

Était-ce utile?

La solution

function get_web_page( $url )
    {               
            $options = array(
            CURLOPT_RETURNTRANSFER  => true, 
            CURLOPT_HEADER          => false,
            CURLOPT_FOLLOWLOCATION  => true, 
        );

        $ch      = curl_init( $url );
        curl_setopt_array( $ch, $options );
        $content = curl_exec( $ch );
        curl_close( $ch );

        return $content;
}

echo get_web_page("http://www.emirates.com/account/english/miles-calculator/miles-calculator.aspx?org=BOM&dest=JFK&trvc=0&h=7b1dc440b5eecbda143bd8e7b9ef53a27e364b");
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top