tags:

views:

33

answers:

1

I have a script that lets me log into xbox live using simplebrowser. How ever the browser detector on xbox live takes me to a blank page after log in that has an empty form that needs to be submitted. But the form doesn't show on my browser so simplybrowser can't find it to submitted. The creator of the script says I need to use cURL, how can I use curls with simplebrower? Here's the script.

require_once('simpletest/browser.php');

$browser = new SimpleBrowser();
$browser->get('http://live.xbox.com/en-US/profile/profile.aspx?pp=0&GamerTag=');
$browser->setField('Email Adress', '[email protected]');
$browser->setField('Password', 'blah');
$browser->clickSubmitByName('SI');
$browser->submitFormById('fmHF');
return $browser->getContent();
A: 

I can help you with just sending form using cURL. View form source and get form action url from <form action="(here)" ...> and put it in $link variable. Every form field put in string with field name and value, like this:

$postdata = '[email protected]&Password=blah';

the rest of the script will look like:

$curl_obj = curl_init();
curl_setopt($curl_obj, CURLOPT_URL,$link);
curl_setopt($curl_obj, CURLOPT_TIMEOUT, 20);
curl_setopt($curl_obj, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($curl_obj, CURLOPT_COOKIESESSION, true);
curl_setopt($curl_obj, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl_obj, CURLOPT_COOKIEJAR, "cookiefile");
curl_setopt($curl_obj, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_obj, CURLOPT_POST, 1);
curl_setopt($curl_obj, CURLOPT_POSTFIELDS, $postdata);
$response = curl_exec($curl_obj);

in the $response variable will be returned page content. or just return curl_exec($curl_obj);

Gtx
thanks bro, but no luck.
John Sims
try `file_put_content('return.htm',$response);` just to see what it returns.
Gtx