1

Is there any way to send PHP POST request to remote URL and get result as html source. I need get my exam results from https://www.eps.go.kr/eo/VisaFndRM.eo?langType=sl here using PHP.

i tried this

<?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);
 ?>

but it returns blank page.any idea how to do it

Nikhil Vaghela
  • 2,050
  • 2
  • 12
  • 28
  • It is called a **request** because it comes from the **client**. – Rax Weber Oct 28 '16 at 10:17
  • u can use `http_build_query($xml)` – devpro Oct 28 '16 at 10:17
  • u can use file_get_contents or fopen check out here http://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents – marcus Oct 28 '16 at 10:32
  • first check apache log and debug curl errors using curl_error() before it add this 2 lines to your code curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); – marcus Oct 28 '16 at 10:42

0 Answers0