简体   繁体   中英

Import XML data via https

Is it possible to get/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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM