携程api开发
程序员文章站
2022-05-02 09:20:36
...
如何获取上图的内容信息?在携程没找到对应接口,询问官方群,基本不搭理!
回复讨论(解决方案)
CURL用过没
源码里如果有内容的话应该是可以抓取吧
官方群不搭理是正常的,你采集别人的东西,对别人服务器增加压力。当然不会搭理你。
');$pos2 = strpos($content, '');$content = substr($content, $pos1, $pos2-$pos1);// hrefpreg_match_all('/(.*?)/i', $content, $matches);$price = $matches[1];$data = array();for($i=0,$len=count($href); $i $href[$i], 'src' => $src[$i], 'title' => $title[$i], 'price' => $price[$i], );}print_r($data);?>
Array( [0] => Array ( [href] => http://vacations.ctrip.com/tickets/p1833645.html [src] => http://pkgpic.ctrip.com/images2/1/152/152_3391_g07660.jpg [title] => 【限量热卖!亲子套票(父亲节6.14-15)】广州长隆水上乐园门票(购票享5大特权!) [price] => 285 ) [1] => Array ( [href] => http://vacations.ctrip.com/tickets/p1655820.html [src] => http://pkgpic.ctrip.com/images2/1/152/152_1660_g07660-m.jpg [title] => 广州塔观光门票(景区现付) [price] => 135 ) [2] => Array ( [href] => http://vacations.ctrip.com/tickets/p83829.html [src] => http://pkgpic.ctrip.com/images2/1/152/152_3331_g07660-m.jpg [title] => 广州岭南印象园景区门票(景区现付) [price] => 30 ) [3] => Array ( [href] => http://vacations.ctrip.com/tickets/p1811853.html [src] => http://pkgpic.ctrip.com/images2/1/27/27_523_g07660-m.jpg [title] => 【热卖!】广东珠海横琴长隆国际海洋度假区门票(各景区) [price] => 100 ) [4] => Array ( [href] => http://vacations.ctrip.com/tickets/p84788.html [src] => http://pkgpic.ctrip.com/images2/1/152/152_919_s28632-m.jpg [title] => 广州海洋馆门票 [price] => 120 ) [5] => Array ( [href] => http://vacations.ctrip.com/tickets/p1659651.html [src] => http://pkgpic.ctrip.com/images2/1/27/27_134_s31517-m.jpg [title] => 【独家!特权日半价热卖(6.28-29日)】珠海海泉湾海洋温泉门票(景区现付) [price] => 90 ) [6] => Array ( [href] => http://vacations.ctrip.com/tickets/p84522.html [src] => http://pkgpic.ctrip.com/images2/1/207/207_697_s45214-m.jpg [title] => 广东顺德长鹿农庄门票 [price] => 35 ))
你可以去看下ucenter文档
感谢大家的回复,携程有接口,只是没有公开,已经搞定!
推荐阅读
-
循序渐进学.Net Core Web Api开发系列【4】:前端访问WebApi
-
循序渐进学.Net Core Web Api开发系列【5】:文件上传
-
详解通过API管理或定制开发ECS实例
-
android开发教程之获取使用当前api的应用程序名称
-
Jquery编程开发 api 速查表实现方法分享
-
C#阿里云短信接口API开发步骤
-
Web API---part2课程介绍+part1复习
-
浅谈 PHP 与手机 APP 开发(API 接口开发)
-
使用Python下的XSLT API进行web开发的简单教程
-
基于Maya API和PySide2的插件开发(用TextBrowser实现文件信息的显示)