|
-
Apr 5th, 2006, 02:13 AM
#1
Thread Starter
Frenzied Member
[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.
-
Apr 5th, 2006, 02:38 AM
#2
Re: Read HTML of a URL
Use file_get_contents(url).
-
Apr 5th, 2006, 03:13 AM
#3
Thread Starter
Frenzied Member
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);
}
-
Apr 5th, 2006, 07:14 AM
#4
Re: [RESOLVED] Read HTML of a URL
I thought you wanted the source to be stored in as a PHP variable?
-
Apr 5th, 2006, 07:57 AM
#5
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|