Jump to content

skillednerd

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

skillednerd's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks I got it to work off your sample code. I finally got it working correctly thanks very much!! $lines = file('access.00.log'); //$opt = array(); foreach($lines as $line){ if(!preg_match("/^#/", $line)){ $thisx = htmlspecialchars($line); $thisx = preg_replace("/\s+/", ", ", $thisx); //removed the extra white space and comma on the end $thisx = substr_replace($thisx ,"",-2); $pC = explode(",", $thisx); echo "Value1 = $pC[0]<br />"; } }
  2. That works but I can't get the lines out of the array though. I am trying $opt[0] and can't actually pull the lines from it
  3. Well I want to have the values separated by comma. I thought I needed the 'value' but don't just comma separated. Like app-stop, application, 2011-04-19, 00:02:10 The problem come with the comments in the file with the # before it so it comes at the beginning of file and every so many results there is another #field list. I do have comma separated working its just the blank lines formed when trying to remove all the lines starting with # The problem is when using: $patternx = '/^.*\#.*\R$/'; $newx = ''; $new_hold = preg_replace($patternx, $newx, $thisx); It doesn't get rid of the lines it creates a blank line with return in it. So results look like Blank Line Blank Line Blank Line Blank Line server-stop, server, 2011-04-19 And in the middle of results where field list (# field, field, field .. .) the blank lines are there. And when I use explode to create an array from it messes all that up.
  4. Ok no problem. code $lines = file('access.00.log'); foreach ($lines as $line_num => $line) { $thisx = htmlspecialchars($line); $patternx = '/\#(.*)\n/i'; $newx = ''; $new_hold = preg_replace($patternx, "", $thisx); $patterny = '/ /'; $newy = ','; $new_hold2 = preg_replace("/\s+/", ", '", $new_hold); $new_hold3 = preg_replace("/,/", "',", $new_hold2); And flash media log I am working with #Version: 1.0 #Start-Date: 2011-04-19 00:02:10 #Software: Adobe Flash Media Server 4.0.0 r1121 x86 #Date: 2011-04-19 #Fields: x-event x-category date time tz x-ctx s-ip x-pid x-cpu-load x-mem-load x-adaptor x-vhost x-app x-appinst x-duration x-status c-ip c-proto c-proto-ver s-uri cs-uri-stem cs-uri-query c-referrer c-user-agent c-client-id cs-bytes sc-bytes c-connect-type x-sname x-sname-query x-suri-query x-suri-stem x-suri x-file-name x-file-ext x-file-size x-file-length x-spos c-spos cs-stream-bytes sc-stream-bytes x-service-name x-sc-qos-bytes x-comment x-eid x-sid x-trans-sname x-trans-sname-query x-trans-file-ext x-trans-mode x-soffset x-codec-type x-codec x-plugin x-page-url x-smax-rec-size x-smax-rec-duration x-forwarded-for app-stop application 2011-04-19 00:02:10 EDT 45fdkfjwdj - 12607 - - _defaultRoot_ mobile.chatcadet.com 45fdkfjwdj _definst_ - - - - - - - - - - - 3073 3376 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - app-start application 2011-04-19 00:02:14 EDT 45fdkfjwdj - 12607 - - _defaultRoot_ mobile.test.com 45fdkfjwdj _definst_ - - - - - - - - - - - 0 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - connect-pending session 2011-04-19 00:02:20 EDT 192.168.1.1 192.168.1.1 12607 0 1 _defaultRoot_ mobile.test.com 45fdkfjwdj _definst_ 0 100 76.25.101.105 rtmp - rtmp://mobile.test.com/45fdkfjwdj rtmp://mobile.test.com/45fdkfjwdj - rtmp://mobile.test.com/45fdkfjwdj FMLE/3.0 (compatible; FMSc/1.0) 4702111235045409135 3073 3073 normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - connect session 2011-04-19 00:02:20 EDT 192.168.1.1 192.168.1.1 12607 0 1 _defaultRoot_ mobile.test.com 45fdkfjwdj _definst_ 0 200 76.25.101.105 rtmp - rtmp://mobile.test.com/45fdkfjwdj rtmp://mobile.testt.com/45fdkfjwdj - rtmp://mobile.test.com/45fdkfjwdj FMLE/3.0 (compatible; FMSc/1.0) 4702111235045409135 3073 3073 normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - disconnect session 2011-04-19 00:04:27 EDT 192.168.1.1 192.168.1.1 12607 0 1 _defaultRoot_ mobile.chatcadet.com 45fdkfjwdj _definst_ 127 200 192.168.1.1 rtmp - rtmp://mobile.chatcadet.com/45fdkfjwdj rtmp://mobile.chatcadet.com/45fdkfjwdj - rtmp://mobile.test.com/45fdkfjwdj FMLE/3.0 (compatible; FMSc/1.0) 4702111235045409135 3073 3376 normal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5. I am working on parsing a file. I have pretty much getting what I want but I am missing a ' at beginning of line. How can I put ' at beginning of each line? Thanks in advance example output this', 'that', 'ok', 'now' see just how the beginning of this is missing ' Thanks!
  6. I have stats log file I want to parse lines from. The lines I want to get are: GET /xxxx/xxxx/xxxx/xxxx/xxx HTTP I am trying to get those lines and the regex works to get them but I cant figure out how to process the results I want to print out each match to the browser. Here is the php file I am using and the output it outputs is: Array ( ) <?php $url = "filex"; $filepointer = fopen($url,"r"); if($filepointer){ while(!feof($filepointer)){ $buffer = fgets($filepointer,4096); $file .= $buffer; } fclose($filepointer); } else { die("Could not open file"); } $regexname = "/^GET(.*)HTTP/i"; preg_match_all('/^GET(.*)HTTP/i',$file,$match); $result = $match[1]; print_r($result) ; ?> Thanks in advance!
  7. Hello, I was wondering how I can call another web page. I don't want to read the page I just need to send it information like test.php?action=this I don't need to read or store I just need to pass it info so it can handle some site changes on the other site. Thanks in advance!
  8. Linux I will google and find out thanks!
  9. How do I give both root and user to have ownership of the folder? I thought only one user could own a file at a time.
  10. I am able to get directory size of folder inside folders owned by me but I need to get folder size of a root owned folder. Is it possible to do this? Thanks in advance!
  11. Cant actually get that to work. mysql_query( "SELECT UPPER(DATE_FORMAT(`birth`, '%Y-%b-%d')) as `f_date` FROM `154k_USA_profiles`" ); $ybirth = $row['f_date'];
  12. I have a db with db with date and the format for the date is 1975-12-22 and I want them to appear as 1975-DEC-22 I don't mind changing the date from date to varchar to make this happen maybe pulling each record and using find and replace or something. What would be the best way to make this happen. thanks in advance.
  13. I have done select statements where you loop through all the records. But what I need to do is pull record from one database than insert parts of that record into the second. The issue I have is no knowing how to select a different db with out stopping the loop of the first. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.