如何将html页面的页面内容写入php文件?

时间:2016-05-17 17:46:01

标签: php html

我写了一个PHP代码,它将使用HTTP POST方法登录成绩系统,但我在将页面内容写入php文件或任何文件时遇到问题。

 try {
    $curl = curl_init();
    $fP = fopen("assigmentcode.php","w");
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $pagecontent = curl_exec($curl);

    fwrite($fP,$pagecontent);
        fclose($fP);
          header('Location: assigmentcode.php');

    curl_close($curl); 


   }
catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

0 个答案:

没有答案