<?php
function login($purl, $pData = "") {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $purl); //login URL
curl_setopt($ch, CURLOPT_POST, 1);
$postData = 'login=login&login%3Ausername=XXXXXXXX&login%3Apassword=XXXX&login%3Aloginimg.x=53&login%3Aloginimg.y=9&javax.faces.ViewState=j_id1';
/*$postData='
login:username=brad
&login:password=xxxxx
&txthdbtn=Login
&imageField.x=27
&imageField.y=8';
*/
curl_setopt($ch, CURLOPT_POSTFIELDS, $pData);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec($ch);
if(!$store) {
echo 'error occurred';
}
echo "_______________<br />";
print_r($store);
echo "_______________<br />";
return $ch;
}
function downloadUrl($Url, $ch) {
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/"');
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
return $output;
}
$uuu = "https://www.beconsumables.com/cm/UserShunt2.cfm?action=logon";
$login_url = "https://www.aviall.com/aviall/login-iframe.seam";
$ref = "http://www.beconsumables.com/cm/support/support.cfm";
$postv = "POSTDATA=username=XXXXX&upasswd=XXXXXX&Submit+Request=%3C%3C+Log+In+%3E%3E";
$zerosch = "http://www.zerosch.com/";
//$session = login($uuu, $postv);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $zerosch); //login URL
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec($ch);
if(!$store) {
echo 'error occurred';
}
$first_url = "https://www.aviall.com/aviall/searchPart.ftl?searchTerm=HL20PB5-3&cid=99777011756";
//$ret = downloadUrl($first_url, $session);
echo "XXXXXXXXXXX<br />";
//print_r($ret);
echo "XXXXXXXXXXX<br />";
?>