- Code: Select all
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://eu.wowarmory.com/login.xml");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0(Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1(ax)");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "accountName=<account>&password=<password>&redirectUrl=/guild-bank-contents.xml%3Fr=Lightning%27s+Blade%26n=Parental+Advisory");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://eu.wowarmory.com/guild-bank-contents.xml?r=Lightning%27s+Blade&n=Parental+Advisory");
curl_setopt($ch, CURLOPT_COOKIEFILE, "\\");
curl_setopt($ch, CURLOPT_COOKIEJAR, "\\");
$result1 = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "http://eu.wowarmory.com/guild-bank-contents.xml?r=Lightning%27s+Blade&n=Parental+Advisory");
$result2 = curl_exec($ch);
curl_close($ch);
We basically need to authenticate with the first curl_exec, and on the second one to get the data (XML), guild bank contents. Now issue is, on the first exec (echo $result1) it says "Redirecting in 10 sec" meaning it worked and it logged in. But on the second it wants me to login before showing the site. I tried to put both queries in one curl session but it didn't work.
Any ideas on this issue?
Oh yeah, if you got PHP and cURL you can check how the two responses look, use this on the bottom of the script:
- Code: Select all
echo str_replace("window.location.href","//window.location.href",$result1)."<hr>".str_replace("window.location.href","//window.location.href",$result2);