Recently, I uploaded a file into two servers, one is my hosting server and the other is aws EC2 server. However, I'm getting result of the file from my hosting server, but nothing from aws EC2 server.
Hosting server: http://amhappy.net/naverbook.php (getting result normally, even though not completed)
AWS EC2 server : http://awamp.duckdns.org/naverbook.php (getting nothing from this server)
The file "naverbook.php" is all the same file each other.
I'm confused with what's wrong is there. Do I need to install any language or something on AWS EC2 server? I installed apache2,php,mysql,python,curl,phpmyadmin .. I guess that's all.
Here is my file "naverbook.php" below:
<?php
$client_id = "";
$client_secret = "";
$encText = urlencode("유닉스");
$url = "https://openapi.naver.com/v1/search/book.json?query=".$encText;
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "X-Naver-Client-Id: ".$client_id;
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "status_code:".$status_code."
";
curl_close ($ch);
if($status_code == 200) {
echo $response;
} else {
echo "Error 내용:".$response;
}
?>
<< This Question has been solved: sudo apt-get install php7.0-curl was the correct answer. Thank you for you all answered to my question.>>
I got a hint from here :
https://stackoverflow.com/questions/32972846/php-script-works-only-in-local-host-not-in-amazon?rq=1