Yes, file_get_contents()
returns that msg "sorry! something went wrong." for me also. Make API call using PHP CURL. Let's try like this way-
Note:
URL which is not retrieved by file_get_contents(), because their
server checks whether the request come from browser or any script?. If
they found request from script they simply disable page contents.
So that you have to make a request similar as browser request. PHP
Curl is suitable choice for this kind of job. See here
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://batdongsan.com.vn/phan-tich-nhan-dinh/thi-truong-can-ho-cao-cap-can-mot-su-sang-loc-khat-khe-ar97716",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}