아래 코드를 사용하여 원격 호스트에서 데이터를 가져와야합니다.file_get_contents가 원격 호스트에서 작동하지 않습니다.
$url = 'https://domain.com/cgi-bin/cgi.exe';
$data = array('email' => $email, 'password' => $password);
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
내부 네트워크에서는 정상적으로 작동하지만 외부 네트워크에서는 정상적으로 작동합니다. 포트 80과 포트 443 모두에 대해 방화벽이 열렸지 만 여전히 작동하지 않습니다. 내가 놓친 다른 것이 있습니까?
로 설정 allow_url_fopen을 특성이 있어야합니다 귀하의 서버;'를? –
빈을 반환합니다. – user1576748