plugins – Using file_get_contents within admin but keep logged in
Quick question as I’m not having much luck finding an answer on Google.
I’m running a file_get_contents in a plugin I’m building to get the HTML of another page within the admin. The HTML is showing but the problem is, it’s loading the /wp-login.php page HTML and not the specified URL.
$data = file_get_contents('wp-admin/options-general.php?page=another_page'); $html_sourcecode_get = htmlentities($data); echo $html_sourcecode_get;
Does anyone know how to keep the HTML grab as if I was still logged in? Do I need to use cURL with credentials?
Note: I have tried the wp file system alternative and it returns a critical error.