如何仅使用php发送post请求

如何仅使用php发送post请求,php,Php,有没有办法将PHPPOST请求发送到远程URL,并将结果作为html源代码。 我需要从https://www.eps.go.kr/eo/VisaFndRM.eo?langType=sl这里使用PHP 我试过这个 <?php $url = 'https://www.eps.go.kr/eo/VisaFndR.eo'; $xml = array('srchFlag' => 'Y', 'langType' => 'sl', 'natNm' => 'sl', 'sKorT

有没有办法将PHP
POST
请求发送到远程
URL
,并将结果作为html源代码。 我需要从
https://www.eps.go.kr/eo/VisaFndRM.eo?langType=sl
这里使用
PHP

我试过这个

<?php $url = 'https://www.eps.go.kr/eo/VisaFndR.eo';
    $xml = array('srchFlag' => 'Y', 'langType' => 'sl', 'natNm' => 'sl', 'sKorTestNo' => '0072016P50000001', 'sLginId' => '', 'sLginPw' => '');
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    echo $response;
    curl_close($ch);
 ?>


但是它返回空白页。知道如何做吗?

它被称为请求,因为它来自客户端。你可以使用
http\u build\u query($xml)
u可以使用file\u get\u contents或fopen check out在这里首先检查apache日志,并使用curl\u error()调试curl错误,然后再将这两行添加到你的代码curl\u setopt中($ch,CURLOPT\u FOLLOWLOCATION,1);curl\u setopt($ch,CURLOPT\u SSL\u VERIFYPEER,0);它之所以被称为请求,是因为它来自客户端。你可以使用
http\u build\u query($xml)
u可以使用file\u get\u contents或fopen签出这里首先检查apache日志,并使用curl\u error()调试curl错误,然后再将这两行添加到你的代码curl\u setopt中($ch,CURLOPT_FOLLOWLOCATION,1);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);