Search Results

Search found 4 results on 1 pages for 'ermac2014'.

Page 1/1 | 1 

  • getting vbulletin captcha image with curl

    - by ermac2014
    hi I need to download Vbulletin captcha images on my HDD "from vbulletin register page" using curl and PHP. I really need to get samples of captcha images from several VBulletin boards. I'm collecting these samples for research purposes. anyway, here is what I done with curl till now. 1- download register.php page. 2- parse the downloaded page to get captcha image url. 3- download that image. now I have done step 1 and 2 correctly. but in step 3 when I try to download the captcha image I don't get the captcha. I just get either a very tiny blank gif picture. or I get a png picture with vbulletin word on it. I really don't know what i'm doing wrong. I tried to output the html and push it to the browser the image shows correctly. but thats not what I want. I want to download the image and save it on my HDD. here are some codes I've been working on: //get contents with curl function get_content($url) { $theString = parse_url($url); $cookieName = $theString['host']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url."register.php"); curl_setopt($ch, CURLOPT_REFERER, $url."register.php"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)'); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies/cookie.txt"); //saved cookies curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies/cookie.txt"); //saved cookies curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $string = curl_exec ($ch); //print_r(curl_getinfo($ch)); curl_close ($ch); return $string; } //vbulletin main page $url = 'http://blavbulletin.com/'; //get the page $results = get_content($url); if (preg_match_all('/<img[^>]*id\=\"imagereg\"[^>]*src\=\"([^\"]*)\"[^>]*>/s', $results , $captchaimages)) { $captcha = $captchaimages[1][0]; echo "<img src='$url"."$captcha'>"; //when echoed the pic shows correctly //now get the pic $file = get_content("$url"."$captcha"); //save the pic on HDD file_put_contents("captcha.jpg", $file); } any help would be appreciated.. regards,

    Read the article

  • including php file from another server with php

    - by ermac2014
    hi I have 2 php files each file on different server. lets say the first file called includeThis.php and the second called main.php the first file is located in (http://)www.sample.com/includeThis.php and the second located in (http://)www.mysite.com/main.php so now what I want is to include the first file into my second file. the contents of the first file is like: <?php $foo = "this is data from file one"; ?> the second file like: <?php include "http://www.sample.com/includeThis.php"; echo $foo; ?> is there any way I can do this? thanks in advance

    Read the article

  • How to get list of declared functions with their data from php file?

    - by ermac2014
    I need to get list of functions with their contents (not only the function name) from php file. I tried to use regex but it has lots of limitations. it doesn't parse all types of functions. for example it fails if the function has if and for loop statements. in details: I have around 100 include files. each file has number of declared functions. some files has functions duplicated in other files. so what I want is to get list of all functions from specific file then put this list inside an array then I will be using array unique in order to remove the duplicates. I read about tokenizer but I really have no idea how to make it grab the declared function with its data. all I have is this: function get_defined_functions_in_file($file) { $source = file_get_contents($file); $tokens = token_get_all($source); $functions = array(); $nextStringIsFunc = false; $inClass = false; $bracesCount = 0; foreach($tokens as $token) { switch($token[0]) { case T_CLASS: $inClass = true; break; case T_FUNCTION: if(!$inClass) $nextStringIsFunc = true; break; case T_STRING: if($nextStringIsFunc) { $nextStringIsFunc = false; $functions[] = $token[1]; } break; // Anonymous functions case '(': case ';': $nextStringIsFunc = false; break; // Exclude Classes case '{': if($inClass) $bracesCount++; break; case '}': if($inClass) { $bracesCount--; if($bracesCount === 0) $inClass = false; } break; } } return $functions; } unfortunately, this function lists only the function names.. what I need is to list the whole declared function with its structure.. so any ideas? thanks in advance..

    Read the article

  • wscript.shell running file with space in path with PHP

    - by ermac2014
    I was trying to use wscript.shell through COM objects with php to pass some cmd commands to cURL library (the DOS version). here is what I use to perform this task: function windExec($cmd,$mode=''){ // Setup the command to run from "run" $cmdline = "cmd /C $cmd"; // set-up the output and mode if ($mode=='FG'){ $outputfile = uniqid(time()) . ".txt"; $cmdline .= " > $outputfile"; $m = true; } else $m = false; // Make a new instance of the COM object $WshShell = new COM("WScript.Shell"); // Make the command window but dont show it. $oExec = $WshShell->Run($cmdline, 0, $m); if ($outputfile){ // Read the tmp file. $retStr = file_get_contents($outputfile); // Delete the temp_file. unlink($outputfile); } else $retStr = ""; return $retStr; } now when I run this function like: windExec("\"C:/Documents and Settings/ermac/Desktop/my project/curl\" http://www.google.com/", 'FG'); curl doesn't run because there is a problem with the path. but when I remove the spaces from the path it works great. windExec("\"C:/curl\" http://www.google.com/", 'FG'); so my question is how can I escape these spaces in wscript.shell commands? is there anyway I can fix this? thanks in advance :)

    Read the article

1