Re: [PHP] Object Array?
I have an object from using simpleXML and inside that object is an array holding even more objects. However, it's not acting like an array and therefore I can't go through it. (i.e. I can't use the count function to see how big it is and loop through it) This below should be an array: $xml-RES-R When I use print_r($xml-RES) I get the below. As you can see [R] = Array but yet in the above example it is an object. I'm so confused and lost. Can anyone help? PHP version 5.0.4 SimpleXMLElement Object ( [M] = 2010 snip [R] = Array ( [0] = SimpleXMLElement Object ( [U] = http://.../benefits/ snip ) [1] = SimpleXMLElement Object ( [U] = http://.../benefits/benefits_websites.html snip ) [2] = SimpleXMLElement Object ( [U] = http://www..com/jobs//benefits.html You are right: $xml-RES-R is an array. If it doesn't act like an array, you might try assigning it to a new variable. Maybe something like this: $MyArray = $xml-RES-R; print_r($MyArray); Others might have better ideas. Keep trying. --J I've tried that even going so far as doing: $MyArray = array(); $MyArray = $xml-RES-R print_r($MyArray); I still run into the same problem. Hm. jay
Re: [PHP] Object Array?
I tried with no success yesterday to get an answer to this question so I'll try again. I have an object from using simpleXML and inside that object is an array holding even more objects. However, it's not acting like an array and therefore I can't go through it. (i.e. I can't use the count function to see how big it is and loop through it) use foreach on it (I think 'it' is a weirdo object that implements an iterator interface - which pretty much sums up simpleXML ;-): foreach ($xml-RES-R as $r) { echo $r-U, $r-UD; // etc } does that get you anywhere? what happens when you do: foreach ($xml-RES-R as $key = $r) { echo $r-__toString(); // or echo $key; } ? That actually works. Strange because I tried this method first yesterday and spent over an hour trying to get it to work and now it's working? AH! :) Below is the code I use. foreach ($xml-RES-R as $key = $r) { echo $r-U.'br'; echo $r-UD.'br'; echo $r-UE.'br'; echo $r-T.'br'; echo $r-RK.'br'; echo $r-S.'br'; echo $r-LANG.'br'; echo 'hr'; } I've tried that and $xml-RES-R only goes through one record $xml-RES-R[0] and then it stops. What I did find that worked was this. in what way does it stop? $i = 0; while (isset($xml-RES-R[$i]) || !empty($xml-RES-R[$i]) { // do stuff $i++; } odd. I don't suppose $xml-RES-R has any methods does it? like hasChildren() or hasAttributes()?
[PHP] Reading large files via PHP?
I'm reading in a 66MB file into php so I can parse it and load it into a database. However, it is taking a long time for php to read the file. So long that the script times out. I know about the ini_set(max_execution_time, 120) or whatever length I want to set the time out for the script, but my question is as follows. Is it possible to read in a file and at the same time echo out a status of how far along the file has been read? The code I have right now is below. Just wondering if what I'm trying to do is possible and how to do it. // set script timeout ini_set(max_execution_time, 120); // import file name $log_file_name = access_log.1; echo Reading access log!br/; if (!$ac_arr = file(./$log_file_name)) { echo Couldn't load access log!; die; } Thanks!
RE: [PHP] Reading large files via PHP?
I'm reading in a 66MB file into php so I can parse it and load it into a database. However, it is taking a long time for php to read the file. So long that the script times out. I know about the ini_set(max_execution_time, 120) or whatever length I want to set the time out for the script, but my question is as follows. Is it possible to read in a file and at the same time echo out a status of how far along the file has been read? The code I have right now is below. Just wondering if what I'm trying to do is possible and how to do it. // set script timeout ini_set(max_execution_time, 120); // import file name $log_file_name = access_log.1; echo Reading access log!br/; if (!$ac_arr = file(./$log_file_name)) { echo Couldn't load access log!; die; } Thanks! Even if you get around the execution time the above code is going to use up 66megs of memory to store that file in $ac_arr. You'd be much better off doing something like: $fd = fopen(./$log_file_name, r); while ( !feof($fd) ) { $buf = fread($fd, 32768); // process buffer here } fclose($fd); That will let you do your progress thing as well as not eat up so much memory. Play around with values of 32768 to see if smaller or larger makes any different on your system. Good luck! Ahhh.. Okay that's very cool and I did not know that. I knew that it was chewing up a lot of memory reading it all at once. I guess the only thing I have to worry about now is if I do a read like that will it truncate a whole line instead of getting the whole line? The reason why I ask is that if possible I would rather have it read line by line for X lines and then process that buffer then go and grab more lines until end of file. Is that possible?
RE: [PHP] Is there a way to display data from database for SelectOptions in a form?
[snip]Let's look at it another way, why 70-80 lines of code when 4 will do it properly when done correctly?[/snip] I agree with this line of thinking especially for a new person to php. When I first read the solution that was so long I thought to myself great and this person is new to php and now they are going to be scared of php. I really think one of the appeals of php is it's simplicity of getting things done and getting those things done quickly. Yes it's great having one function to output every select html form but is it really necessary?
[PHP] SOAP Problems.
I'm trying to call a SOAP service where you pass it a couple of dates and it is supposed to return stuff. My testing code is below along with the errors I'm getting. What's strange is that it's not working in php but it works perfectly in Flash. The request it is sending is only sending one param the $to value and not the $from value. Any idea what's going on? $from = 06/01/2005; // some date but what format? $to = 12/31/2005; // some date but what format? $client = new SoapClient(some.wsdl, array(trace = 1, exceptions = 0)); var_dump($client-__getFunctions()); echo brbr; var_dump($client-__getTypes()); echo brbr; try { print($client-execute($from, $to)); } catch (SoapFault $exception) { echo $exception; } $client-execute($from, $to); print pre\n; print Request :\n.htmlspecialchars($client-__getLastRequest()) .\n; print Response:\n.htmlspecialchars($client-__getLastResponse()).\n; print /pre; var_dump($client-execute($from, $to)); echo brbr; echo brbr; print($client-__soapCall(execute, array(From = $from, to = $to))); array(1) { [0]= string(44) executeResponse execute(execute $parameters) } array(2) { [0]= string(44) struct execute { string From; string to; } [1]= string(44) struct executeResponse { string wsReturn; } } SoapFault exception: [soapenv:Server.userException] [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', message='Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected ', line=-1, pos=-1 nested=] in /Library/WebServer/Documents/services/soap-test.php:9 Stack trace: #0 /Library/WebServer/Documents/services/soap-test.php(9): SoapClient-__call('execute', Array) #1 /Library/WebServer/Documents/services/soap-test.php(9): SoapClient-execute('06/01/2005', '12/31/2005') #2 {main} Request : ?xml version=1.0 encoding=UTF-8? SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/; xmlns:ns1=somensSOAP-ENV:Bodyns1:execute/param112/31/2005/param1/SOAP-ENV:Body/SOAP-ENV:Envelope Response: ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body soapenv:Fault faultcodesoapenv:Server.userException/faultcode faultstring[TeamworksException name=apos;Process: apos;HR Training Infomationapos; ProcessItem: apos;Untitled0apos; Type: apos;ITEMapos;apos;, message=apos;Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected apos;, line=-1, pos=-1 nested=lt;nonegt;]/faultstring detail/ /soapenv:Fault /soapenv:Body /soapenv:Envelope object(SoapFault)#2 (9) { [message:protected]= string(0) [string:private]= string(0) [code:protected]= int(0) [file:protected]= string(51) /Library/WebServer/Documents/services/soap-test.php [line:protected]= int(16) [trace:private]= array(2) { [0]= array(6) { [file]= string(51) /Library/WebServer/Documents/services/soap-test.php [line]= int(16) [function]= string(6) __call [class]= string(10) SoapClient [type]= string(2) - [args]= array(2) { [0]= string(7) execute [1]= array(2) { [0]= string(10) 06/01/2005 [1]= string(10) 12/31/2005 } } } [1]= array(6) { [file]= string(51) /Library/WebServer/Documents/services/soap-test.php [line]= int(16) [function]= string(7) execute [class]= string(10) SoapClient [type]= string(2) - [args]= array(2) { [0]= string(10) 06/01/2005 [1]= string(10) 12/31/2005 } } } [faultstring]= string(300) [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', message='Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected ', line=-1, pos=-1 nested=] [faultcode]= string(28) soapenv:Server.userException [detail]= string(0) } SoapFault exception: [soapenv:Server.userException] [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', message='Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected ', line=-1, pos=-1 nested=] in /Library/WebServer/Documents/services/soap-test.php:17 Stack trace: #0 /Library/WebServer/Documents/services/soap-test.php(17): SoapClient-__soapCall('execute', Array) #1 {main}
RE: [PHP] SOAP Problems SOLVED!
I got it to work! What I had to do is make an associtive array with the keys being the name of the params that needed to get passed to the 'execute' method that it was calling via soap. Or conversely you could write the $params as objects instead of an array. Code below: $params[From] = 06/01/2005; // also can use $params-From = date; $params[to] = 12/31/2005; // also can use $params-to = date; $client = new SoapClient(some.wsdl, array(trace = 1, exceptions = 0)); try { print($client-execute($params)); } catch (SoapFault $exception) { echo $exception; } -Original Message- From: Jay Paulson (CE CEN) [mailto:[EMAIL PROTECTED] Sent: Tue 1/10/2006 11:32 AM To: php-general@lists.php.net Subject: [PHP] SOAP Problems. I'm trying to call a SOAP service where you pass it a couple of dates and it is supposed to return stuff. My testing code is below along with the errors I'm getting. What's strange is that it's not working in php but it works perfectly in Flash. The request it is sending is only sending one param the $to value and not the $from value. Any idea what's going on? $from = 06/01/2005; // some date but what format? $to = 12/31/2005; // some date but what format? $client = new SoapClient(some.wsdl, array(trace = 1, exceptions = 0)); var_dump($client-__getFunctions()); echo brbr; var_dump($client-__getTypes()); echo brbr; try { print($client-execute($from, $to)); } catch (SoapFault $exception) { echo $exception; } $client-execute($from, $to); print pre\n; print Request :\n.htmlspecialchars($client-__getLastRequest()) .\n; print Response:\n.htmlspecialchars($client-__getLastResponse()).\n; print /pre; var_dump($client-execute($from, $to)); echo brbr; echo brbr; print($client-__soapCall(execute, array(From = $from, to = $to))); array(1) { [0]= string(44) executeResponse execute(execute $parameters) } array(2) { [0]= string(44) struct execute { string From; string to; } [1]= string(44) struct executeResponse { string wsReturn; } } SoapFault exception: [soapenv:Server.userException] [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', message='Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected ', line=-1, pos=-1 nested=] in /Library/WebServer/Documents/services/soap-test.php:9 Stack trace: #0 /Library/WebServer/Documents/services/soap-test.php(9): SoapClient-__call('execute', Array) #1 /Library/WebServer/Documents/services/soap-test.php(9): SoapClient-execute('06/01/2005', '12/31/2005') #2 {main} Request : ?xml version=1.0 encoding=UTF-8? SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/; xmlns:ns1=somensSOAP-ENV:Bodyns1:execute/param112/31/2005/param1/SOAP-ENV:Body/SOAP-ENV:Envelope Response: ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body soapenv:Fault faultcodesoapenv:Server.userException/faultcode faultstring[TeamworksException name=apos;Process: apos;HR Training Infomationapos; ProcessItem: apos;Untitled0apos; Type: apos;ITEMapos;apos;, message=apos;Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected apos;, line=-1, pos=-1 nested=lt;nonegt;]/faultstring detail/ /soapenv:Fault /soapenv:Body /soapenv:Envelope object(SoapFault)#2 (9) { [message:protected]= string(0) [string:private]= string(0) [code:protected]= int(0) [file:protected]= string(51) /Library/WebServer/Documents/services/soap-test.php [line:protected]= int(16) [trace:private]= array(2) { [0]= array(6) { [file]= string(51) /Library/WebServer/Documents/services/soap-test.php [line]= int(16) [function]= string(6) __call [class]= string(10) SoapClient [type]= string(2) - [args]= array(2) { [0]= string(7) execute [1]= array(2) { [0]= string(10) 06/01/2005 [1]= string(10) 12/31/2005 } } } [1]= array(6) { [file]= string(51) /Library/WebServer/Documents/services/soap-test.php [line]= int(16) [function]= string(7) execute [class]= string(10) SoapClient [type]= string(2) - [args]= array(2) { [0]= string(10) 06/01/2005 [1]= string(10) 12/31/2005 } } } [faultstring]= string(300) [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', message='Internal Script error: org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a non-numeric character was found where a numeric was expected ', line=-1, pos=-1 nested=] [faultcode]= string(28) soapenv:Server.userException [detail]= string(0) } SoapFault exception: [soapenv:Server.userException] [TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type
RE: [PHP] CSS Switching
Why don't you make a prit.php file that handles all the dynamic content and displays it with the CSS file you want. jay -Original Message- From: Mike Tuller [mailto:[EMAIL PROTECTED] Sent: Mon 1/9/2006 11:58 AM To: php list Subject: [PHP] CSS Switching I am drawing a blank on how to go about doing this for some reason. I have a page that pulls info from a database, and I want to have a version for viewing, and a version fro printing. Since the data is dynamic, I need to keep the data, but be able to switch the stylesheet. Can someone give me a push in the right direction as to how they would go about this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dynamic Array Index using Variable
You could use the isset() or the empty() functions. http://us3.php.net/manual/en/function.empty.php http://us3.php.net/manual/en/function.isset.php But do you want to check all the fields that are being submitted or just specific ones that you set in the $reqfields array? If you want to check all the submitted fields just run through the $_POST or $_GET arrays, depending on your form method. jay -Original Message- From: Chris Lott [mailto:[EMAIL PROTECTED] Sent: Mon 1/9/2006 2:31 PM To: PHP General Mailing List Subject: [PHP] Dynamic Array Index using Variable I want to do something like this to check if a variety of submitted form fields (crn, instructor, etc) have any value in them: $reqfields = array('crn', 'instructor'); $errorflag = 0; foreach ($reqfields as $field) { if ($_REQUEST[$field] == '') { $errorflag = 1; } } But I can't quite get the syntax right... help?? c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and SOAP newbie questions
I recently got handed a project that requires me to use PHP to talk to a WSDL SOAP service. I'm not new to PHP but I am new to SOAP. I have the basic idea of how SOAP works but still have a few questions I am hoping you all can answer for me. Which library would be better to use? NuSOAP or PEAR's SOAP library? Someone else is writing the WSDLs that I need to access. Does this mean that I just have to use a SOAP client to access the information or would I need to make a SOAP server? I guess what I'm asking is what is the difference between a SOAP client and a SOAP server? Lastly, do you all know of any good online tutorials I could check out that google may not suggest? Thanks! Jay
[PHP] Included php files in a cron job?
I'm in the process of writing a PHP program that is going to be called once a week via a cron job. I don't have a place to really test this hence the reason why I'm asking about it here. My question is can my php program include other php files and still get executed correctly when the cron job runs? For example: #!/path/to/php ?php require_once($file); //do something ? Will the code in $file work correctly when the cron job executes the php file that has something simular to what I have above? Thanks!
[PHP] Converting IP Address to int value?
I'm in the process of parsing through a apache access_log file and putting the information into a database. Right now I have the ip addresses going into a database as a character format xxx.xxx.xxx.xxx and then later I'm creating my queries to search for ip addresses xxx.xxx.%, which I think is really ineffecient. Therefore, I wanted to add a new field in my database which would be just an int value and have php convert the ip address to an int for database insertion. Then have an sql query that would just convert that int back into an ip address if I needed. My ultimate goal is to be able to write a query simular to this: SELECT * FROM Apache_Stats WHERE int_ip BETWEEN INET_ATON('xxx.xxx.0.0') AND INET_ATON ('xxx.xxx.255.255') Is there a function in PHP that will convert the xxx.xxx.xxx.xxx ip address to the same number that INET_ATON() is converting it to? I know about ip2long() but in the PHP docs it doesn't convert right unles you use the printf(%u...) function. Thanks!
[PHP] Parsing through an Apache Log File?
Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /home.html HTTP/1.1 200 8220 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /styles/redesign.css HTTP/1.1 200 2381 http://wfmu.wfm.pvt/home.html; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! //path to log file $path = ./; //name of log file $log_filename = access_log; if (!file_exists($path.$log_filename)) { echo file does not exists!; die; } //open log file if (!$handle = fopen($path.$log_filename, r)) { echo error in loading file!; die; } //get date range from past 7 days put into array for comparision of log file $dates = array(); $days = 7; for ($i=1;$i=$days;$i++) { $dates[] = date(d/M/Y, strtotime(-$i day)); } //get document types that need to match $docs = array(); $docs[] = .doc; $docs[] = .pdf; $docs[] = .html; $docs[] = .htm; $docs[] = .php; $docs[] = .flv; $contents = ; while (!feof($handle)) { $line = fgets($handle); //look to see if the line has a date we are looking for foreach ($dates as $date) { //if date is in the line look for the doc type we want if (strpos($line, $date)) { //look to see if the line has the doc type we want foreach ($docs as $doc) { //if the line has the doc type we want then grab the region //and increment the counter for page hit //make sure to break out of the loops once found //need to add functionality for lines that have file extensions //that are not wanted but also have file extensions that are wanted if (strpos($line, $doc) { break; } //end if } //end foreach ($docs as $doc) break; } //end if } //end foreach ($dates as $date) } //close log file fclose($handle); Thanks! Jay
RE: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /home.html HTTP/1.1 200 8220 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /styles/redesign.css HTTP/1.1 200 2381 http://wfmu.wfm.pvt/home.html; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! snip Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... CREATE TABLE `rawLogs` ( `ipAddress` int(15) NOT NULL default '0', `rfcIdentity` varchar(32) NOT NULL default '', `apacheUser` varchar(32) NOT NULL default '', `date` int(15) NOT NULL default '0', `request` longtext NOT NULL, `statusCode` varchar(32) NOT NULL default '', `sizeBytes` int(11) NOT NULL default '0', `referer` longtext NOT NULL, `userAgent` longtext NOT NULL, KEY `ipAddress` (`ipAddress`), FULLTEXT KEY `search` (`request`,`referer`,`userAgent`) ) TYPE=MyISAM; A few questions with this train of thought. I can see the advantages of putting the raw log file into a database but I would still need to parse the file and get the information out of it for each column. I'm also not quite sure what some of your feilds are for 'rfcIdentity'?? What is that? Why would I need an 'apacheUser' also? Anyway, not too sure how I would get this information in an easy way for the massive amounts of inserts I would have to do on a 10 meg log file. jay
RE: [PHP] Parsing through an Apache Log File?
Jay Paulson (CE CEN) wrote: Hello everyone! I've been given the responsiblity of coding an apache access_log parser. What my tasks are to do is to return the number of hits for certain file extensions that happen on certain dates with specific IP address. As of now I'm only going back 7 days in the log looking for this information and I'm only looking for 5 file types (.doc, .pdf, .html, .php, and .flv). I'm using the fgets() function so I can read the file line by line and do the matches that I need to do and increment the counters as needed. Right now I have 3 loops looking for everything, which seems to me not to be the best way of doing this. I've also encountered that a line may have the file extension I want but it's actually the soucre of another file. (see below for example) Log file example: I want the first line but not the second line. The second line has a .css file which was used by the .html file therefore I don't want this line. I do want the first line that all it has is .html and no other files. 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /home.html HTTP/1.1 200 8220 - Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) 10.25.40.64 - - [01/Jan/2006:07:33:18 -0600] GET /styles/redesign.css HTTP/1.1 200 2381 http://wfmu.wfm.pvt/home.html; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) At any rate, here's some of my psudo code/code for what I'm trying to accomplish. I know there has to be a better way for this and I'm looking for suggestions! snip Save yourself a ton of work. Dump the raw logs into a db, and you can do all the queries on the db. Something like this... I took your idea and did a search on Google and found that this has already been done for me! Check it out! http://www.php-scripts.com/php_diary/012103.php3 Very cool :) jay
RE: [PHP] Parsing through an Apache Log File?
If this is just a one time thing you're looking to do, all of this may be over the top. However, if the bosses are going to want to review this data month in and month out, I think the time spent doing something like this will be worth it. As of now I've got it working and inserting the data into the database! I did see your code and since you are being so generious as to let me use it I'll probably tweak it (a very little bit!) as we are going to be using this script once a week to read the log files. We are using it to get some numbers out of it so make our own custome stats thing based off of a lot more numbers that included this as part of the number getting. Thanks so much for your help! jay