php - How to get full html content of specific url?
576
I used several method to get html content of aptoide.com in php.
1)file_get_contents();
2)readfile();
3) curl as php function
function get_dataa($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)");
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
4)PHP Simple HTML DOM Parser
include_once('simple_html_dom.php');
$url="http://aptoide.com";
$html = file_get_html($url);
But all of them give empty output for aptoide.com Is there a way to get full html content of that url ?
Answer
Solution:
echo file_get_contents('http://www.aptoide.com/');
works fine for me.So it's possible that
aptoide.com
has been blocked you. If you want to change your IP (as you said in comment) you have to use this:Answer
Solution:
use your curl get_dataa function with this line added:
because that page is redirecting to www.aptide.com full function: