Reply to Re: fgets($fp) question

Your name:

Reply:


Posted by Hilarion on 09/06/05 18:05

>> > Months ago I wrote a script using
>> > $fp = fsockopen($host,$port)
>> > to open a web page displaying timetable information and then
>> > $thisLine = fgets($fp) to read each line of the page
>> >
>> > $thisLine then contained the html souce code for the page line by line
>> > I was thus able to look at the source code for the page
>> >
>> > Recently the page has changed and I find that now $thisLine no longer
>> > contains the source code for the page but rather the text as it is
>> > displayed by a browser.
>> >
>> > Can anyone explain what might have happenned and how I can access the
>> > source code like used to?
>>
>>
>> It looks like the server you were getting the file from was not configured
>> to interprete the pointed file as PHP, so it passed the contents of the
>> file unchanged. Now it does interprete the file as PHP file, so it
>> executes the file and returns the output. It means that the server
>> configuration changed (it might be server-wide change or folder-wide
>> change) or file name extension changed (eg. from .html or .txt to .php).
>> In general the server SHOULD interprete PHP files as PHP files and
>> execute them, so the behavior you are observing now is natural and
>> correct, and the one you got before was wrong.
>>
>> If you want to get the PHP script source from web server, you should
>> use FTP or any other file access protocol, not HTTP.
>
> Obviously I did not make it clear. I do not want to see PHP script source.
> The page I get with $fp = fsockopen($host,$port) is in html
> (generated by ASP I think)
> What I want to get is the same as I see when I "view source" in a browser.

How do you check that those are different? If it's about difference
in HTML, then maybe the script generates different HTML for different
browsers. If it's about getting plain text instead of HTML, then this
looks like a problem in your script (but it still can be caused by
browser recognition, but that's not very probable).


Hilarion

[Back to original 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

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