-4

i need to get html souce code from aspx page,as example can use Go daddy link

I have tried cURL and file_get_contents bui it dons't work. Tried cURL with setting user agent. file_get_contents shows Redirection limit reached!

$url = 'godaddy.com/hosting/website-builder.aspx?ci=88060';
$user_agent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 OPR/22.0.1471.40 (Edition Next)"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
$result=curl_exec($ch); 
curl_close ($ch); 
echo "Results: <br>".$result;
user1978142
  • 7,946
  • 3
  • 17
  • 20
lubuger
  • 45
  • 8

3 Answers3

0

The only thing you can do is viewing the already processed output as html and css.

Right Click -> View Source

However, you won't be able to see the ASPX source code.

Hannes Schneidermayer
  • 4,729
  • 2
  • 28
  • 32
0

Use CURL to read the remote URL to fetch the HTML.

<?php
$url = "http://godaddy.com/hosting/website-builder.aspx?ci=88060";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output=curl_exec($ch); 
echo $output;
?>

How to get Content ot Remote HTML page

Community
  • 1
  • 1
user2316116
  • 6,726
  • 1
  • 21
  • 35
  • I have tried this,file get contents show redirect limit reached,with this one code above shows blank page with words Object moved here! – lubuger Jun 10 '14 at 07:22
  • Use CURLOPT_RETURNTRANSFER option as shown at http://stackoverflow.com/questions/12164196/warning-file-get-contents-failed-to-open-stream-redirection-limit-reached-ab – user2316116 Jun 10 '14 at 07:24
  • i tried this one too,same Object moved to here. – lubuger Jun 10 '14 at 07:26
0

If you want to get just the plain html of that particular site. You can use file_get_contents() on this one and then use htmlentities(). Consider this example:

<?php

$url = 'https://ph.godaddy.com/hosting/website-builder.aspx?ci=88060';
$contents = htmlentities(file_get_contents($url));
echo $contents;

?>

Sample Output

user1978142
  • 7,946
  • 3
  • 17
  • 20