开发者

Import XML data via https

开发者 https://www.devze.com 2023-01-18 05:56 出处:网络
Is it possible to g开发者_JAVA百科et/scrap data from https links using php, the https page ask for a user name and password and has data in XML format. so is it possible to get this data using PHP ?

Is it possible to g开发者_JAVA百科et/scrap data from https links using php,

the https page ask for a user name and password and has data in XML format. so is it possible to get this data using PHP ?


Yes it is possible, just use cURL extension to get page content and then parse it as you may see fit (using XML functions, regex, etc). cURL cand handle SSL, authentication, cookies, etc. For more details see:

http://php.net/manual/en/book.curl.php


First of all you need your webserver and php to act like a https client, for that you need mod_ssl for apache and open_ssl for php. And service you trying to access must have a defined way to send username and password. That way you can log-in and access the xml.


You can use http://simplehtmldom.sourceforge.net/ class, get html from a url and get data from the DOM with jQuery sintax. Very usefull to me.

0

精彩评论

暂无评论...
验证码 换一张
取 消