Answer the question
In order to leave comments, you need to log in
PHP: Get data from remote server
Hello, habrausers and habrausers :)
Given:
There is a site on CMS Drupal, which is located on a server running Debian Sparc 64 OS.
It is necessary to implement access to data from another server using the https protocol on it.
If I use curl, I get the following message: cURL error: Could not resolve host: %hostname%; Host not found
file_get_contents doesn't want to work with https at all.
Question: what to use to access external data? Or how to enable access to external data on the server?
Answer the question
In order to leave comments, you need to log in
Must be
* DNS configured
* allow_url_fopen enabled (for file_get_contents)
* openssl installed
Judging by the error, DNSs are not configured on the server.
Answering the question:
1. Set up your
DEBIAN server 2. You can access data via HTTPS via Curl. If the certificates are self-signed, then you need to ignore errors, as AGvin said
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
Do you have outgoing connections allowed in php.ini? — "allow_url_fopen"
directive Are they allowed in the firewall?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question