You are here: Re: "Show Source" button « All PHP « IT news, forums, messages
Re: "Show Source" button

Posted by Frank on 10/01/05 21:03

>>> My bad... Sorry.
>>> I want to view the html code, not the php. I know you can do it through
>>> the browser but I need it for a 'convenience' situation (long story).
>>> Any ideas??
>>>
>> You could try a seperate page opened either through a link or a
>> javascript popup, which reads via fopen (if allowed) the page over http.
>>
>> Try the code below, but it is without any error checking! You still have
>> to check, if the site given is valid and if it is a site you want them
>> to see!
>>
>> -rauch
> Sorry, missed some below!
>
> <?php
> if(isset($_GET['site'])){
> $fp = fsockopen($server, 80, $errno, $errstr, 30);
> if(!$fp){
> //echo an error
> } else {
> $out = "GET ".$_GET['site']." HTTP/1.1\r\n";
> $out .= "Host: ".$server."\r\n";
> $out .= "Connection: Close\r\n\r\n";
> fwrite($fp, $out);
> if($fp!=false){
> //Echo some header
> while (!feof($fp)) {
> $output. = htmlentities(fgets($fp, 128));
> }
> //Do some Highlighting (don't know if the function above
> //is capable of html highlighting
> //Echo some footer
> } else {
> //Output error message
> }
> fclose($fp);
> }
> } else {
> //Error Message
> }
> ?>

Rauch,

I'm not sure how to use your code you posted. I pasted it into a new page
and changed 'site' to the page that I want the source displayed??
But I'm getting:
parse error, unexpected '=' line 21

I left the error message parts blank too because I'm not sure if I needed
them since this seemed like a cut and dry operation to get done.

Can you give me more details on how to use this? Sorry but I'm pretty new to
php.

I didn't realize showing html using php would be such a pia! :/

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация