Whoopage
04-07-2008, 07:23 PM
Hey all - I am attempting to write a script that will login to a page, submit post variables to the remote page/form, and then I want to be able to pull the remote form results back through cURL and display them on my site.
Here is the code I have so far, the only issue I have is, how do I pull back the form results and display them?:
<?php
if(isset($_POST[’domainlist’]))
{
$domainlist = $_POST[’domainlist’];
}
$domainlist = preg_replace('/\s+/', ' ', $domainlist);
//seperate multiple keywords into array space delimited
$domains = explode(" ", $domainlist);
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://partner.skenzo.com/login.php');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email=username@user.com&password=password');
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 1st REQUEST (FORM LOGIN)
$store = curl_exec ($ch);
// SEND DATA TO SKENZO DOMAIN FORM
curl_setopt($ch, CURLOPT_URL, 'http://partner.skenzo.com/bulkDomainStatsDd.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Alert cURL to the fact that we're doing a POST, and pass the values for POSTing.
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "startdate=$_POST[startdate]&enddate=$_POST[enddate]&domainlist=$domains);
$output = curl_exec($ch);
// CLOSE CURL
curl_close ($ch);
?>
Thats what I have so far - any input or help on this and on how to get the results back?
Thanks in advance!
Here is the code I have so far, the only issue I have is, how do I pull back the form results and display them?:
<?php
if(isset($_POST[’domainlist’]))
{
$domainlist = $_POST[’domainlist’];
}
$domainlist = preg_replace('/\s+/', ' ', $domainlist);
//seperate multiple keywords into array space delimited
$domains = explode(" ", $domainlist);
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'http://partner.skenzo.com/login.php');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email=username@user.com&password=password');
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 1st REQUEST (FORM LOGIN)
$store = curl_exec ($ch);
// SEND DATA TO SKENZO DOMAIN FORM
curl_setopt($ch, CURLOPT_URL, 'http://partner.skenzo.com/bulkDomainStatsDd.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Alert cURL to the fact that we're doing a POST, and pass the values for POSTing.
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "startdate=$_POST[startdate]&enddate=$_POST[enddate]&domainlist=$domains);
$output = curl_exec($ch);
// CLOSE CURL
curl_close ($ch);
?>
Thats what I have so far - any input or help on this and on how to get the results back?
Thanks in advance!