1. A user copies and pastes a URL into a form and submits it.
2. The PHP code validates the URL based on preset credentials and proceeds to grab the page contents of the URL.
3. If the URL and the contents pass set critera, the PHP code then grabs and stores certain elements of the page into a file.
I've got most of it done. I'm experienced with PHP and it should work fine. The only problem is that the URLs that are submitted into the form require preauthorization for their contents to be extracted, otherwise get_file_contents just returns the login page. Now, I do have a username and password for the site the submitted URLs are hosted on, and I can easily grab the contents of the pages manually (if I sign in and navigate to them), but I would love for it to be done automatically. Is there anyway this can be done?
This is the code of my page with the form on it that users enter the URL in:
<form method="post" action="checkproof.php"> <font face="verdana" size="3"> Proof URL: <input type="text" name="proofurl" size="100"> </font> <br><br> <input type="submit" value=" - - - Check my proof! - - - "> </form>
This is the beginning of the code for checkproof.php that fails:
<?php $proofurl = $_POST["proofurl"]; $urlcontents = file_get_contents($proofurl); ?>Instead of containing the content of $proofurl, $urlcontents ends up containing the main site sign in form page (several elements of which I have removed).
<form action="[CFN Validation Location]" method="post" name="..." id="..."> <input type="hidden" name="NextPage" value="..."> <input type="text" name="email" size="20"> <input type="password" name="password" size="20"> <input type="image" src="..." id="..." name="..." onclick="return doSubmit();"> </form>
Is it possible to use PHP to login to this form with my e-mail and password before calling on $urlcontents allowing access to the page contents?