-1

Possible Duplicate:
How to enable HTTPS stream wrappers

I'm using simple XML to get content from an API. Usually I have no problems but now the URL is HTTPS it doesn't seem to work. Is there anyway around this?

Example XML (url):

<?xml version="1.0"?>
<calendars>
  <calendar accommodation_id="1049165">
    <day date="2012-08-09" vacancy="false" minimum_nights="7" arrival_day="true"/>
    <day date="2012-08-10" vacancy="false" minimum_nights="3" arrival_day="true"/>
    <day date="2012-08-11" vacancy="false" minimum_nights="3" arrival_day="true"/>
    <!-- ... -->
    <day date="2014-01-31" vacancy="true" minimum_nights="3" arrival_day="true"/>
  </calendar>
</calendars>

Example code:

$xml2 = file_get_contents('');
$availability = new SimpleXMLElement($xml2);
Community
  • 1
  • 1
user1482082
  • 37
  • 1
  • 2
  • 5
  • Using HTTPS has nothing to do with SimpleXML - It's entirely dependent upon your server and its configuration. Do `var_dump( $xml2);` - If there's nothing there, then you'll need another method of retrieving the content instead of `file_get_contents()`. – nickb Aug 09 '12 at 12:39
  • According to [this page](http://php.net/manual/en/wrappers.http.php#refsect1-wrappers.http-notes), you need openssl enabled. Do you have it enabled? – Alvin Wong Aug 09 '12 at 14:11
  • Please do not duplicate questions (e.g. here: http://stackoverflow.com/q/11885169/367456) - Instead edit this question to improve it. – hakre Aug 09 '12 at 16:05

1 Answers1

0

You are using the XML API of the www.casapilot.com website.

The API is via HTTPS, one example URI is:

https://www.casapilot.com/api/1/accommodations/calendar.xml?auth_token=hyXHjP8QdrRuX8q3FsbC&id=1049165

For HTTPs to work, PHP needs the openssl extension. The information is given on the related Stream Wrapper Page:

Note: HTTPS is only supported when the openssl extension is enabled.

The openssl extension is then used for all HTTPS "files" transparently with the stream-wrapper for all URIs starting with https://.

See as well the duplicate question:

Community
  • 1
  • 1
hakre
  • 193,403
  • 52
  • 435
  • 836