环境是 windows wamp php5.5
------------------------------------------
程序写法:
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
//$url = 'https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=jQuery110208172749384481603_1456294051449&appid=4001&com=shentong&nu=3304810729274&vcode=&token=&_=1456294051453';
$url = 'https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=jQuery110208172749384481603_1456294051449&appid=4001&com=jd&nu=12148326312&vcode=&token=&_=1456294051453';
//$url ='https://www.jb51.net';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//这个是重点。
$data = curl_exec($curl);
curl_close($curl);
echo ($data);
---------------------------------------------------------------
直接在地址栏输入 :
https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=jQuery110208172749384481603_1456294051449&appid=4001&com=jd&nu=12148326312&vcode=&token=&_=1456294051453
得到结果是
两个结果不一样,查了一些信息,dll 什么的,加了也不好用。帮忙你们测一下。 解决一下,谢谢
回复讨论(解决方案)
缺少 cookie 的接收和传递
前辈我的意思是,可以直接用CURL请求 HTTPS这上地址不。 这里没有发现传递值的关系啊
就是一个请求,然后把值解析出来。 (这是个物流接口,我从网上拔下来的
或有什么更好的接口没,谢谢
$url = 'https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=jQuery110208172749384481603_1456294051449&appid=4001&com=jd&nu=12148326312&vcode=&token=&_=1456294051453';$cookie = tempnam("/tmp", "cookie");$t = parse_url($url);//先获取 cookie$curl = curl_init();curl_setopt($curl, CURLOPT_URL, "$t[scheme]://$t[host]/$t[path]");curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie);curl_exec($curl);//再获取数据$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie);$data = curl_exec($curl);curl_close($curl);//解析得到的 jsonp 数据$s = preg_replace('/^.*\((.+)\).*/', '$1', $data);print_r(json_decode($s, 1));
Array( [msg] => [status] => 0 [data] => Array ( [info] => Array ( [status] => 1 [com] => jd [state] => 3 [context] => Array ( [0] => Array ( [time] => 1456304591 [desc] => 货物已完成配送,感谢您选择京东配送 ) [1] => Array ( [time] => 1456299587 [desc] => 配送员开始配送,请您准备收货,配送员,郭林伟,手机号,18511532257 ) [2] => Array ( [time] => 1456298302 [desc] => 货物已分配,等待配送 ) [3] => Array ( [time] => 1456298298 [desc] => 货物已到达【东大桥站】 ) [4] => Array ( [time] => 1456292041 [desc] => 货物已完成分拣,离开【北京小杜社分拣中心】 ) [5] => Array ( [time] => 1456291522 [desc] => 货物已到达【北京小杜社分拣中心】 ) [6] => Array ( [time] => 1456284653 [desc] => 货物已完成分拣,离开【北京土桥接货仓】 ) [7] => Array ( [time] => 1456284549 [desc] => 货物已交付京东快递 ) [8] => Array ( [time] => 1456284549 [desc] => 货物已到达【北京土桥接货仓】 ) ) [_source_com] => ) [com] => jd [company] => Array ( [url] => http://www.kuaidi100.com/all/jd.shtml?from=openv [fullname] => 京东快递 [shortname] => 京东 [icon] => Array ( [id] => [smallurl] => https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1807529516,3291075151&fm=58 [smallpos] => 0,1504 [middleurl] => https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1835223070,3312272045&fm=58 [middlepos] => 0,900 [normal] => https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=2992147315,359626353&fm=58 ) [website] => Array ( [title] => www.jd-ex.com [url] => http://www.jd-ex.com/ ) [tel] => 400-603-3600 [auxiliary] => Array ( [0] => Array ( [title] => 运费查询 [url] => http://jd-ex.com/#searchFreight ) [1] => Array ( [title] => 禁运规则 [url] => http://jd-ex.com/forbid.html ) ) ) [source] => Array ( [logo] => https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1429564979,1787167512&fm=58 [title] => 数据来自快递100 [url] => http://www.kuaidi100.com/ [name] => 快递100 ) ))
thanks

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.

PHP remains a powerful and widely used tool in modern programming, especially in the field of web development. 1) PHP is easy to use and seamlessly integrated with databases, and is the first choice for many developers. 2) It supports dynamic content generation and object-oriented programming, suitable for quickly creating and maintaining websites. 3) PHP's performance can be improved by caching and optimizing database queries, and its extensive community and rich ecosystem make it still important in today's technology stack.

In PHP, weak references are implemented through the WeakReference class and will not prevent the garbage collector from reclaiming objects. Weak references are suitable for scenarios such as caching systems and event listeners. It should be noted that it cannot guarantee the survival of objects and that garbage collection may be delayed.

The \_\_invoke method allows objects to be called like functions. 1. Define the \_\_invoke method so that the object can be called. 2. When using the $obj(...) syntax, PHP will execute the \_\_invoke method. 3. Suitable for scenarios such as logging and calculator, improving code flexibility and readability.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools