The website https://www.openbux.com/ expire cookies after just one one day or one session.
Is there any way to use cURL with PHP to get a login and to change the cookies expire date, for example, for one year?
And I have problem to use the cURL with CAPTCHA. Is there any solution for that?
I know I should use something like that
<?
$cookie_file_path = "C:\path\to\save\cookie.txt";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/6";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.example.com/target.php");
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Do not print anything now.
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, "login_username=XXXXX&passWord=YYYYY");
$html = curl_exec($ch);
var_dump(urlencode($html));
curl_close();
?>
but I can’t use this with CAPTCHA… And I don’t have the target URL to send the date
because the login form which I got it from here https://www.openbux.com/login
like this
<form action="" method="post">
<input type="hidden" name="token" value="23cc81bca35588e5356bf07a1bb4e04538304e41" />
<fieldset><h1>Please log in<a href="javascript:void(0);" onclick="showK();" title="Show keyboard"><img src="images/keyboard.png" style="float: right; margin-right: 12px; margin-top: 4px;" alt="Show keyboard" border="0"></a></h1>
<div class="formular">
<span class="formular_top"></span>
<div class="formular_inner"> <span><a href="reset" class="lost">Lost Password?</a></span>
<label> <strong>Username:</strong><span class="input_wrapper"> <input name="login_username" id="login_username" type="text" onfocus="text=this" value="" /> </span> </label>
<label> <strong>Password:</strong> <span class="input_wrapper"> <input name="login_password" id="pwd" onfocus="text=this" type="password" /> </span> </label>
<label> <strong>Verification Code:</strong> <span class="input_wrapper" style="width: 49px; float: right; margin-left: 8px; background: url(images/login/input_small.gif) no-repeat;"> <input name="code" type="text" maxlength="4" onfocus="text=this" style="text-transform: uppercase;" /> </span>
<img src="captcha.jpg" height="22" alt="captcha" style="float: right;" /> </label>
<input type="hidden" name="7" value="Israel" />
<ul class="form_menu"><li><span class="button"><span><span><em>SUBMIT</em></span></span>
<input type="submit" name="Login2" value="Login" />
so I don’t have in the action="" in any URL. Is it possible any PHP cURL script that allow me to login automatic with my long date cookie file?
You can manually edit the cookiejar file after it’s created. You could also login with a browser like Firefox and then copy the cookie data from the browser cookies window to the cookiejar file. You will have to convert it to the correct format though.
Regarding the captcha, send a request for captcha.jpg and then write it to file or output it to a browser, solve it and then add the answer to CURLOPT_POSTFIELDS.