Import XML data via https
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.
精彩评论