|
43
|
Programación / Desarrollo Web / cambiar el color
|
en: 28 Octubre 2016, 00:56 am
|
chrome.browserAction.onClicked.addListener(function(tab) { chrome.tabs.executeScript({ code: 'document.getElementById(textarea_simulator).style.backgroundColor="red"' }); }); }); //author --
|
|
|
47
|
Programación / Desarrollo Web / obtener captcha con curl
|
en: 17 Octubre 2016, 19:34 pm
|
encontre este codigo en internet, y quiero obtener su captcha de esta pagina http://www.ruat.gob.bo/vehiculos/consultageneral/InicioBusquedaVehiculo.jsfsu captcha se genera cada ves que refresco la pagina, es posible obtenerlo? <?php $cookie="cookie.txt"; function open($url) { curl_setopt($ch, CURLOPT_USERAGENT , 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2'); return $result; } function between($string, $start, $end) { { echo $string[0]; return $string[0]; } return ''; } function get_captcha() { $url = 'https://academics.vit.ac.in/student/stud_login.asp'; $open = open($url); $code = between($open, '<img src='https://academics.vit.ac.in/student/captcha.asp', '">'); return 'https://academics.vit.ac.in/student/captcha.asp' . $code; } function rahul() { echo $capth; $username="xyz"; $password="abc"; $url=url of the form in which you want to submit your data; $cookie="cookie.txt"; $veri=$capth; $com="Login"; $postdata = "regno=".$username."&passwd=".$password."&vrfcd=".$veri."&submit=".$com; curl_setopt ($ch, CURLOPT_USERAGENT , "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_COOKIEFILE , $cookie); // <-- add this line echo $result; } ?> <html> <body> <form action="" method="post"> <img src="<?php echo get_captcha(); ?>" border="0" /><br /> <input type="text" name="code" value=" <?= isset($_POST['code']) ? htmlspecialchars($_POST['code']) : '' ?>" /><br /> <input type="submit" name="submit" value="submit"/> </form> <?php if(isset($_POST['submit'])) { rahul(); } ?> </body> </html>
|
|
|
48
|
Programación / Desarrollo Web / se puede pasar contenido de txt a .json?
|
en: 17 Octubre 2016, 03:21 am
|
tengo varios archivos .txt igual a este contenido 0 69 164 0 71 117 0 73 84 0 79 80 0 82 83 0 82 115 0 83 154 0 84 48 1 69 104 1 71 100 1 73 83 1 79 82 1 82 121 1 83 117 1 84 46 2 69 204 2 71 94 2 73 85 2 79 102 2 82 88 2 82 147 2 83 87 2 84 42 lo quiero pasar a .json se puede? cada columna con diferentes campos en el .json
|
|
|
49
|
Programación / Desarrollo Web / Re: enviar formulario de una web ajena desde mi formulario de mi proyecto
|
en: 12 Octubre 2016, 19:48 pm
|
en el file access.log en las ultimas lineas aparece esto, efectivamente muestra la fecha 12/Oct/2016:13:43:06 use chrome ::1 - - [12/Oct/2016:13:43:06 -0400] "GET /xampp/img/head-windows.gif HTTP/1.1" 200 1362 "http://localhost/xampp/head.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:06 -0400] "GET /xampp/img/head-for.gif HTTP/1.1" 200 791 "http://localhost/xampp/head.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:05 -0400] "GET /xampp/img/xampp-logo-new.gif HTTP/1.1" 200 4878 "http://localhost/xampp/head.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:05 -0400] "GET /xampp/start.php HTTP/1.1" 200 3801 "http://localhost/xampp/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:05 -0400] "GET /xampp/navi.php HTTP/1.1" 200 4060 "http://localhost/xampp/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:07 -0400] "GET /xampp/img/apachefriends.gif HTTP/1.1" 200 979 "http://localhost/xampp/navi.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:07 -0400] "GET /xampp/xampp.js HTTP/1.1" 200 573 "http://localhost/xampp/navi.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:07 -0400] "GET /xampp/img/bitnami-xampp.png HTTP/1.1" 200 22133 "http://localhost/xampp/start.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:43:08 -0400] "GET /xampp/img/strichel.gif HTTP/1.1" 200 61 "http://localhost/xampp/navi.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:46:36 -0400] "GET /applications.html HTTP/1.1" 200 1441 "http://localhost/xampp/navi.php" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" ::1 - - [12/Oct/2016:13:46:36 -0400] "GET /bitnami.css HTTP/1.1" 200 2142 "http://localhost/applications.html" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"
no hace login, alguien ve algun error? MOD: No hacer doble post!
|
|
|
50
|
Programación / Desarrollo Web / Re: enviar formulario de una web ajena desde mi formulario de mi proyecto
|
en: 12 Octubre 2016, 18:28 pm
|
hice la prueba sobre este codigo: > > function curlPost($postUrl, $postFields) { > > $cookie = 'cookie.txt'; // Setting a cookie file to store cookie > > $ch = curl_init(); // Initialising cURL session > > // Setting cURL options > curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // Prevent cURL from verifying SSL certificate > curl_setopt($ch, CURLOPT_FAILONERROR, TRUE); // Script should fail silently on error > curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); // Use cookies > curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow Location: headers > curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Returning transfer as a string > curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); // Setting cookiefile > curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); // Setting cookiejar > curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1a2pre) Gecko/2008073000 Shredder/3.0a2pre > ThunderBrowse/3.2.1.8"); // Setting useragent > > curl_setopt($ch, CURLOPT_URL, $postUrl); // Setting URL to POST to > curl_setopt($ch, CURLOPT_POST, TRUE); // Setting method as POST > > curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields)); // Setting POST fields as array > > $results = curl_exec($ch); // Executing cURL session > curl_close($ch); // Closing cURL session > > return $results; > } y lo uso asi > > $user ="userxxx"; > $pass = "passxxxxxxx"; > > > $login_url = "http://www.xxxxx.com/repositorio/consultas_web/"; > $post_array = array ('login' => $user, > 'password' => $pass); // Building post array. > > > $results = curlPost($login_url, $post_array);
no envia solo me muestra la pagina y no hace el envio post
|
|
|
|
|
|
|