Reputation: 413
I want to get the HTML code of a particular site. It asks me to register myself first so that I can be redirected to their home page. Now, my question is: is it possible to retrieve the HTML code of the desired page just by choosing option ‘View Page Source’ which appears on right click? Is there any other way to fetch the HTML code?
Upvotes: 0
Views: 2692
Reputation: 4941
Using any browser, the "View Page Source" option will show you the source of the page, as received by the browser (which may be different then the source currently displayed). You also have the option of using the File > Save Page As
(or similar) menu option to save a copy of the html code of the page from the browser.
It is also possible to use command line tools like curl and wget to download the page to your local machine. Those tools provide options to send data (such as cookies or headers to identify yourself) along with the request.
Upvotes: 0
Reputation: 60
Yes it is possible to view HTML via 'View page source' or you could use PHP as mentioned in the comments.
'usign php yes php.net/manual/en/function.file-get-contents.php – Vitorino fernandes'
You could also let a website and or program do it for you but it's trustability depends on the site and or program, Do note it is NOT possible to view the PHP source since that is server-side.
Upvotes: 0
Reputation: 429
There are multiple ways of getting the HTML source code of a page
One way, as you already know is by viewing the page's source code.
If you Right Click -> View Page Source
or just press Ctrl + U
you will view the source code in your browser
If you are using linux, you can use wget
to get the source code.
Just open up a console and type wget www.somewebsite.com
and you will get the HTML source code along with any CSS and JS links.
However, you cannot get the PHP code using any method unless you have FTP access to the server
Upvotes: 1