-1

My Code is

$check=  get_text22('http://localhost:81/ci/',$numb);
file_put_contents('fail.txt', $check, FILE_APPEND);

function get_text22($filename,$id){
    $context=...
    $fp_load = fopen("$filename", "rb",false,$context);
    if ( $fp_load ){
        while ( !feof($fp_load) ){
            $content .= fgets($fp_load, 8192);
        }
        fclose($fp_load);
        return $content;
    }
}

Generate File fail.txt

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

    <link rel="icon" type="image/png" href="ci/assets/favicon.ico">
   ...

But This generate html file. I want it can generate php file without process how it written at server in <?php tag.

Community
  • 1
  • 1
  • 1
    You can't read source of php file through http protocol. You get result of execution – splash58 Dec 20 '17 at 09:12
  • 1
    It's impossible. You can get such source only on server where your code working, setting absolute path to file – splash58 Dec 20 '17 at 09:17
  • What is your issue; is it that your output doesn't contain PHP code or that your out? Or something else? Please clarify your question – Martin Dec 20 '17 at 09:38
  • I want Php file, Without process from server –  Dec 20 '17 at 09:39

1 Answers1

0

There are two ways to do this:

  1. Read the PHP file from your filesystem instead of the URL of the results of executing the PHP from your HTTP server.
  2. Configure the HTTP server running on localhost:81 to serve up PHP source code instead of executing it. i.e. Do the opposite of what this question suggests.

The first of those two options is the sensible one.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335