Kahuki Webmaster Forum and Discussion Community  

Go Back   Kahuki Webmaster Forum and Discussion Community > Website Development & Management > Programming > PHP



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2006, 03:31 PM
abrahamthomas's Avatar
Member
 
Join Date: Nov 2005
Posts: 58
abrahamthomas is on a distinguished road
Can PHP read in source code from another webpage external of the server to which the PHP code is run on?


I need to be more specific, all I want to do is read in HTML source code from another page using PHP

Reply With Quote
  #2 (permalink)  
Old 06-27-2006, 03:36 PM
Rookie
 
Join Date: Jul 2007
Posts: 7
Bazza is on a distinguished road
Only if the source code comes over the web page. Most PHP code is executed on the server, and you don't see it unless there is an error. This hides the source code, and should work the exact same way for your PHP code so that somebody can't go and steal it. If this was a file share, or the server was not executing the source code, you could read it, but you might have to save it before you execute it.

Reply With Quote
  #3 (permalink)  
Old 06-27-2006, 03:53 PM
Rookie
 
Join Date: Jul 2007
Posts: 7
Bazza is on a distinguished road
Not sure what you are are asking so...

1. you want to read the HTML of another website using a php page on your server?

1a. Yes, you can read the HTML of any page from another server. This sounds similar to a crawler or spider.

possible helpful site:

Building a Simple Search Engine with PHP
http://www.onlamp.com/pub/a/php/2002/10/24/simplesearchengine.html

2. You want to view the HTML source generated by a PHP page?

2a. Yes, just view source from any web site and you can see the HTML code, it won't matter if the page uses Php. However, You won't be able to see the original php.

Reply With Quote
  #4 (permalink)  
Old 06-27-2006, 03:56 PM
Rookie
 
Join Date: Oct 2006
Posts: 5
AAAllen is on a distinguished road
is your server running linux?

if so you can use

<?php exec ( lynx --dump $PAGE_URL ) ?>
or
<?php exec ( links--dump $PAGE_URL ) ?>

depending on the server

Reply With Quote
  #5 (permalink)  
Old 06-27-2006, 04:00 PM
Ong's Avatar
Ong Ong is offline
Rookie
 
Join Date: Feb 2006
Posts: 7
Ong is on a distinguished road
Okay, if all you want to do is get the HTML source code from a web page, then you could probably open the file using fopen(). But unless you have the correct permissions, all you can do is read the file.

On the note specified by somebody else, you cannot read PHP source code because, when a call is made to request a PHP web page, the server processes the file, and THEN outputs it to the browser.

Reply With Quote
  #6 (permalink)  
Old 06-30-2006, 01:53 PM
Rookie
 
Join Date: Jul 2007
Posts: 5
wooncherk is on a distinguished road
U can open other pages as files:

$f = fopen ("http://www.site/page.htm", r);

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
css code??? Lucia99 Webdesign & HMTL 2 01-02-2008 06:11 AM
coldfusion code to asp.net? x-man Programming 1 04-28-2007 05:49 PM
Please help me with this code weevilboy JavaScript 2 04-25-2007 02:21 PM
I have css code on a website telling links to change color and it works. I put this same css code? dondi Webdesign & HMTL 4 06-30-2006 07:44 PM
asp.net projects with source code and screenshots in real time? harriet_0828 Programming 2 04-09-2006 05:23 AM


All times are GMT. The time now is 12:16 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0