GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-May-2004, 15:31
Optical Optical is offline
New Member
 
Join Date: May 2004
Posts: 2
Optical is on a distinguished road

Getting HTML Source with PHP


Hey guys,

If I wanted to get the HTML source of a specified URL, how would I do that?

Code:
$URL = "http://www.google.com";
I just want to know if there's any sort of method to access the actual HTML of $URL.

Sorry if this isn't too clear, I'm kinda new at this.

~Optical
  #2  
Old 18-May-2004, 15:44
Optical Optical is offline
New Member
 
Join Date: May 2004
Posts: 2
Optical is on a distinguished road

Nevermind...


Quote:
Originally Posted by Optical
Hey guys,

If I wanted to get the HTML source of a specified URL, how would I do that?

Code:
$URL = "http://www.google.com";
I just want to know if there's any sort of method to access the actual HTML of $URL.

Sorry if this isn't too clear, I'm kinda new at this.

~Optical

Heh, right after I submited this post, I found the answer.
Code:
$source = file("http://www.google.com"); echo $source;

~Optical
  #3  
Old 18-May-2004, 16:57
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello Optical,

Yes, that would work too but note that file() returns an array.

In fact, the simplest way to get the HTML source off a web page is by using file_get_contents() if your PHP version supports it and the if the fopen wrappers have been enabled.
 
 

Recent GIDBlogNARMY by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having a problem Chuckles Computer Hardware Forum 19 13-Sep-2004 12:17
uisng php to display php dopee MySQL / PHP Forum 6 14-May-2004 18:40
loading an html file from a db using php mdonovan Web Design Forum 8 21-Mar-2004 23:38
web server in secure mode not connecting to http application tcsasp Apache Web Server Forum 0 06-Nov-2003 00:08
html to php tenaki Web Design Forum 17 28-Oct-2003 16:18

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:00.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.