Extracting Current Webpage content using PHP [closed]

  php, web-scraping

I know there are lot many questions like this before about WebScraping using PHP, but I see lot users use file_get_contents() which requires URL as parameter but I don’t want to put the URL I just want to extract the content of the page I am in that is current page.

I have also seen answers recommending to use CURL I also tried that, here I need to give URL which I don’t want to put manually, I want the contents of the current page to be extracted.

<?php
//some code maybe related to session
//I will redirect to some page with some parameters
header('Location: example.php?somepara=thecontent');
.....// here I want to extract the content of the page I am watching right now on browser
//and save it in a text file or any other file type I want
?>

Source: Ask PHP

LEAVE A COMMENT