T
T
terrance2012-10-25 20:34:01
PHP
terrance, 2012-10-25 20:34:01

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

5 answer(s)
S
Sergey Beresnev, 2012-10-26
@terrance

Must be
* DNS configured
* allow_url_fopen enabled (for file_get_contents)
* openssl installed

C
cat_crash, 2012-10-25
@cat_crash

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

A
AGvin, 2012-10-25
@AGvin

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

Tried?
A detailed description of how it works is here

D
Diam0n, 2012-10-25
@Diam0n

Do you have outgoing connections allowed in php.ini? — "allow_url_fopen"
directive Are they allowed in the firewall?

N
noway, 2012-10-25
@noway

file_get_contents doesn't want to work with https at all.
it works fine with https. config problem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question