Train Trips Enquiry

Source: Internet
Author: User

<span style= "FONT-SIZE:18PX;" ><?php# Set the encoding header ("Content-type:text/html;charset=utf-8"), #判断 receive if (Isset ($_post[' submit '))) {#接收数据 $type = $_post[' type ']; #火车类型 $start = UrlEncode ($_post[' start ');  #起始站 $end = UrlEncode ($_post[' end '); #终点站 # Create url# view trips with the http://apis.juhe.cn/train/s?name=g4&key=1f9daa1525abbf6a8d032d439bcbd3bf&dtype= json&start={$start}&end={$end}&traintype={$type} ";//View station times//$url =" Http://apis.juhe.cn/train/s2s? start={$start}&end={$end}&traintype={$type}&key=1f9daa1525abbf6a8d032d439bcbd3bf "; #获取数据 $str = File_  Get_contents ($url); #对json数据进行转换 $str 1 = json_decode ($STR);  Get an object $str2 = Json_decode ($str, true); Get an array of echo ' <pre> ';//Var_dump ($str 1, $str 2); #进行数据遍历 trips foreach ($str 1->result->train_info as $info) { Echo ' train information '. $info. ' <br> '; Echo ' 

Train Trips Enquiry

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.