Results 1 to 5 of 5

Thread: [RESOLVED] Read HTML of a URL

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Resolved [RESOLVED] Read HTML of a URL

    Hello everybody,

    I this possible to read the entire HTML of a url say http://www.google.com into a PHP variable.

    Thanks.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Read HTML of a URL

    Use file_get_contents(url).

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Read HTML of a URL

    Thanks.

    I got this solution with javascript with a google search.

    Code:
    		function GetData()
    		{
    			var url = "http://www.yahoo.com";
    			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    			xmlhttp.Open("POST",url,false);
    			xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    			xmlhttp.send();
    			var result = xmlhttp.responsetext;
    			alert(result);			
    		}

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: [RESOLVED] Read HTML of a URL

    I thought you wanted the source to be stored in as a PHP variable?

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: [RESOLVED] Read HTML of a URL

    Yeah, you are right. I am trying to find a way to get javascript script variable in PHP. penagate's recommended function is also good.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width