Any way to get source code in actual php format from iframe

one text

Solution:

If you want to get the php-sourcecode you will have to write a script for that.

Example (reader.php):

<?php
echo file_get_contents('example.php'); // or $_GET['file'] insetad of 'example.php'

The iframe would have to call reader.php?file=example.php then.

Be warned

This is highly insecure. You will have to take care of thw following things:

  • Sanitizing user-input
  • Prevent directory traversal
  • Limit access to only the files you want to be readable
  • Be very very sure there are no sensitive information in your php-files.

Source