Re: [PHP] Parsing a stdClass Object created with mimeDecode
Graham Anderson wrote: I am trying to get the body text from a number of different emails using mimeDecode [Pear] Unfortunately, it appears that the body text could be in any number of locations in the stdClass Object depending on which email is processed. At this point, I can only access the node by looking at the print_r($structure) directly :( Out of the three different emails I parsed, I got three different locations for the 'body' node $structure-parts[0]-parts[0]-parts[0]-body; $structure-body; $structure-parts[0]-body; Question: Is there a way to generically traverse the entire object generated from Mail_mimeDecode and search for the correct node ? In my case, these conditions need to be met . if (trim($part-ctype_primary)== text trim($part-ctype_secondary) == plain) { $body = $part-body; echo the body text is: $body; } } I've recently needed to do this for a site I'm writing. This is what I came up with to find the first body (for my purposes I don't care about the type). I've not tested it much, but it will be getting a grilling over the coming weeks. It shouldn't be too hard to modify it to ensure it meets your requirements, but bear in mind that an email is not required to have a text/plain part. if ($structure-ctype_primary == 'multipart') { $part = $structure-parts[0]; while ($part-ctype_primary == 'multipart') $part = $part-parts[0]; $body = $part-body; $type = $part-ctype_primary.'/'.$part-ctype_secondary; } else { $body = $structure-body; $type = $structure-ctype_primary.'/'. $structure-ctype_secondary; } Hope that helps. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOMElement-setAttribute() loops forever (node_list_unlink bug?)
Rob Richards wrote: Riku Palomäki wrote: Hello, I'm having problems with DOMElement-setAttribute() -method with my php script. I stripped down the code to this: -- $doc = new DOMDocument(); $doc-resolveExternals = true; $doc-loadXml('!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;a b= /'); $root = $doc-getElementsByTagName('a')-item(0); $root-setAttribute('b', 'gt;'); $root-setAttribute('b', ''); // This will never be executed echo done\n; -- Can you please bug this (no need for the backtrace), so I don't forget it. I see the problem but will take me a day or two to get around to fix. As a work around for now you can do: $root-setAttributeNode(new DOMAttr('b', 'gt;')); $root-setAttribute('b', ''); Ok, http://bugs.php.net/37456 -- Riku -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help w/ 'headers already sent' and file download
Mike Walsh schrieb: I have an application which I am working on which takes a file supplied by the user via a File Upload, peforms some processing on it, then prompts the user to download a generated CSV file. What I would like to do is report some processing statistics prior to the user prior to sending the CSV steam. My CSV export ends with this: header(Content-type: application/vnd.ms-excel) ; header(Content-disposition: attachment; filename=CSVData. . date(Y-m-d)..csv) ; print $csvStream ; Unfortunately if I display any content prior to sending the CSV stream I get the 'headers already sent' error message. Is there a way to both display a web page and send content to be saved by the user? If someone knows of an example I could look at I'd be greatful. Split the page. One php page showing the content and the second generating the csv file. Call that script with Javascript when the page is load. That way you could display the content and download the file. Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 404 After Setting session.save_path to /tmp
Hi All, I get this, Not Found The requested URL /movie1.php was not found on this server. Apache/2.2.0 (Fedora) Server at localhost Port 80 when setting session.save_path to /tmp in /usr/local/lib/php.ini. Even if I change it back, I still get that error. Restarting httpd doesn't fix it. Only a reboot, ouch! Why is this happening? Cheers. httpd = 2.2.2 php = 5.1.4 OS = Fedora 5 Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FIT implementation for PHP
Hello, I am looking for an implemantion of FIT (Framework for Integrated Test) for PHP. http://fit.c2.com/ https://sourceforge.net/projects/fitlibrary/ Now I am thinking about implementing it myself. But before I want to know if anybody is already working on such an implementation or has heart of it? Thanks alot! Ronny Unger # Mail: [EMAIL PROTECTED] WWW: www.php-workx.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Mark Sargent a écrit : Hi All, I get this, Not Found The requested URL /movie1.php was not found on this server. Apache/2.2.0 (Fedora) Server at localhost Port 80 when setting session.save_path to /tmp in /usr/local/lib/php.ini. Even if I change it back, I still get that error. Restarting httpd doesn't fix it. Only a reboot, ouch! Why is this happening? Cheers. Hi, you should check apache log files. I don't know if your server is allowed to write to /tmp. what's the initial (default) session.save_path ? try to set it to a subdirectory of your DocumentRoot. (check httpd.conf for the DocumentRoot). (/www/root/default_vhost/tmp for example, if /www/root/default_vhost is your DocumentRoot). N F httpd = 2.2.2 php = 5.1.4 OS = Fedora 5 Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
nicolas figaro wrote: ... try to set it to a subdirectory of your DocumentRoot. (check httpd.conf for the DocumentRoot). (/www/root/default_vhost/tmp for example, if /www/root/default_vhost is your DocumentRoot). NO - DONT EVER DO THIS tmp/session files should not be stored in a directory that can be [potentially] read via http. .htaccess directives can be used to block access to the dir BUT I still would recommend keeping 'tmp' outside of the web root. just make sure 'tmp' is writable by the user the webserver is running as. N F httpd = 2.2.2 php = 5.1.4 OS = Fedora 5 Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help w/ 'headers already sent' and file download
Rabin Vincent [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 5/16/06, Mike Walsh [EMAIL PROTECTED] wrote: [ ... snipped ... ] Is there a way to both display a web page and send content to be saved by the user? If someone knows of an example I could look at I'd be greatful. No, you cannot display both a webpage and send a file on the same page to the user. What you could do is save the processed file in a temporary folder and provide a link to download the file in your processing statistics page. Or, you could redirect the user to the file after showing the statistics page. Rabin [ ... snipped ... ] I found a solution to my problem - an IFRAME with a 0 height and 0 width does the trick. Here is a thread which helped: http://forums.invisionpower.com/index.php?showtopic=214649 Mike -- Mike Walsh - mike_walsh at mindspring.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP daemons
I've been using PHP for a while with a daemon I made a few years ago, which is in use, working great. I used the example that's in the docs: http://www.php.net/manual/en/ref.sockets.php A few months ago I started to make a new daemon for other purposes, and I decided to build some objects to make it OOP. This small server is almost fully functional, but I got into a small problem: I can't kill the daemon like I used to with the other daemon. I just won't die, unless I get the pid and send a SIGKILL to the pid. Both servers are runned executing the PHP script, which has in the first line: #!/usr/bin/php In the first daemon all I have to do to kill it is execute a pkill server_name. But with the new daemon (the object orientaded one) it doesn't die. Any ideas on why? -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble sending data via TCP socket
On Mon, 15 May 2006, J. King wrote: To further my understanding of how Jabber works I have decided I should try and write my own XMPP implementation in PHP. However, I've run into trouble rather quickly. To connect to a Jabber server, one must open a TCP socket to the server (typically through port 5269) send an XML-based stream header, wait for the server's confirmation and then log in, etc. As an initial test I tried to open a TCP socket, send a stream header, get the server's response, then disconnect. I did so thusly: $server = jabber.org; //example server $port = 5269; //default port $nsStream = http://etherx.jabber.org/streams;; // Streams namespace $socket = stream_socket_client(tcp://$server:$port); $header = stream:stream to='$server' xmlns='jabber:client' xmlns:stream='$nsClient' xml:lang='en' version='1.0'; [snip] stream:error invalid-namespace xmlns='urn:ietf:params:xml:ns:xmpp-streams'/ /stream:error What's the value of $nsClient??? I doesn't look like it's defined at all, so I would guess that your problem is there. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class/function scope general question
On May 15, 2006, at 7:53 PM, Richard Lynch wrote: You can't do that. Yeah I can, sorta. Well not really as I'm having to pass a reference to the class object around. But that works. The whold class has to be in a single contiguous file. Last I checked. To be able to use $this- in the functions yeah, although it was available in the file, outside of a function but that could get *real* dangerous. On the plus side, it's incredibly unlikely that having the functions in separate files was a Good Idea... Well... I know it's not a *good* idea, it's just an intermediate step that's helping me see the class pieces a little better so I *can* figure out the best way to go. I've got a monster that has grown out of control over time that really needs to be tamed. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP daemons
Well, by looking into my cristal ball I think your problem lies at line 12 of file x.php for sure!! It's probably the I_have_not_seen_any_code_at_all(so I can't tell you anything about it) function there. goodluck! - tul Martin Marques wrote: I've been using PHP for a while with a daemon I made a few years ago, which is in use, working great. I used the example that's in the docs: http://www.php.net/manual/en/ref.sockets.php A few months ago I started to make a new daemon for other purposes, and I decided to build some objects to make it OOP. This small server is almost fully functional, but I got into a small problem: I can't kill the daemon like I used to with the other daemon. I just won't die, unless I get the pid and send a SIGKILL to the pid. Both servers are runned executing the PHP script, which has in the first line: #!/usr/bin/php In the first daemon all I have to do to kill it is execute a pkill server_name. But with the new daemon (the object orientaded one) it doesn't die. Any ideas on why? -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador --- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Development Environments/Automation
Thanks. I will check out the links that you and Peer sent me. Qcodo and Cake both look like promising alternatives. I appreciate the help, -Brian Miles Thompson wrote: At 02:01 PM 5/15/2006, Brian Anderson wrote: Hello, I am being asked to find some sort of development environment for PHP/MySQL, if is exists, in which it has some sort of automation/wizzardry. What is being done is a mass of MSAccess interfaces, forms, reports, etc. are needing to be re-written in php and connected to a MySQL database instead of the Access. What is being asked for is something that although being able to build some interfaces through wizzards/gui's, that is be somewhat logical, and streamlined in its management of code and html. Something that implements some kind of smarty tag or similar woould be good instead of say... Macromedia which can do some fairly bloated and cumbersome things with logic and markup. Also, It would need to be flexible enough to manage projects back and forth between wizzards, and hand coding so that one wasn't limited to the narrow applications of the wizzard. Does something like this exist? I have played around with Macromedia, and another app called CodeCharge Studio. I hope that I am asking the right or at least an intelligent question. -Brian Do you mean a framework? Have a look at Qcodo, Cake, etc. Qcodo allows you to preserve your interface while making logic / database changes. Regards - Miles Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP daemons
On Tue, 16 May 2006, M. Sokolewicz wrote: Well, by looking into my cristal ball I think your problem lies at line 12 of file x.php for sure!! It's probably the I_have_not_seen_any_code_at_all(so I can't tell you anything about it) function there. No problem. :-) I solved it making a second script that I run when I want to close the server. This script just conects and sends a shutdown string. I changed the daemon so that it will recieve this string and close all conections, close the socket and break all the loops. :-) Any way, I don't know why the code from the first daemon finish well when a kill is sent to it (remember that this daemon is a copy from the first example at: http://ar2.php.net/manual/en/ref.sockets.php) -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP daemons
Martin, I'm afraid we cannot help you without reading the code, paste it to phpfi.com and send the url here now the general answer is, OOP or not OOP it doesn't matter there is problem in the code whatever and however it's written dude. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP daemons
On Tue, 16 May 2006, Jad madi wrote: Martin, I'm afraid we cannot help you without reading the code, paste it to phpfi.com and send the url here now the general answer is, OOP or not OOP it doesn't matter there is problem in the code whatever and however it's written dude. Yes (the code is really big, that's why I didn't paste it). My question would be then, how can I control a SIGTERM signal from inside a PHP CLI script? P.D.: My original problem was solved, as you can see in an earlier post. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PECL install modify my php.ini? or even look at it?
Richard Lynch wrote: On Thu, May 11, 2006 6:02 pm, D. Dante Lorenso wrote: pecl install memcache Is it possible that pecl has an --extension-dir flag to tell it WHERE to install stuff, or perhaps an optional command line arg or ... Cuz, really, the odds on it being where you want it to be are pretty slim. Odds would be increased if 'pecl' would look at what I've already declared in the PHP.ini file ;-) Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header(Location: ... or Header(Refresh: 0;...
Hi All, I'd really appreciate your advice with this one... I have a cart. Visitors can browse a catalogue, click 'Add to cart', and are taken to the shopping cart with the new item added... This is working perfectly for 99.9% of visitors, although 2 separate support calls have reported they don't get redirected (catalogue page remains in address bar), and the page doesn't load (blank white page with 'Done' in the status bar). Now I'm guessing this has something to do with the header command I'm using: header (Refresh: 0; URL=cart.php?action=addid=$referencec=$catp=$page); exit; I'm guessing the header isn't working, but the exit does, hence no page load. I've searched the web and some contributors say Refresh shouldn't be used, and others say that a 0 Refresh is exactly the same is the same as a 'Location' header command. But is even related to my problem? The user concerned has the same browser version and privacy settings as me. I can get them to re-test, but would like to be fairly confident as to the problem before I do... :) What are your thoughts? Thanks in advance for your help. Best regards, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about templates
I have been using template.inc for templates. It works very well so that I can just work on coding and a designer can make the page look good. But I noticed that there are several versions (some of which don't seem to work), and its no longer in the phplib. Is there some reason not to use it? And if that's the case what would be the substitute? I have looked at Smarty and it doesn't seem to be as useful the way I'm using templates. Charlene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Development Environments/Automation
Brian Anderson wrote: I am being asked to find some sort of development environment for PHP/MySQL, if is exists, in which it has some sort of automation/wizzardry. What is being done is a mass of MSAccess interfaces, forms, reports, etc. are needing to be re-written in php and connected to a MySQL database instead of the Access. Have a look at http://freshmeat.net/projects/limbas/ -- Best regards Peer Oliver Schmidt PGP Key ID: 0x83E1C2EA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about templates
This one time, at band camp, Charlene Wroblewski [EMAIL PROTECTED] wrote: looked at Smarty and it doesn't seem to be as useful the way I'm using templates. I'm not surprised, 1000 lines of code to do hello world Kevin -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about templates
Sure if all you are writing is a hello world page, but if you are writing out an application that is more complex, wouldn't the savings and managability be beneficial enough to justify? ... code reusability ... Don't ya think? Why is it easier to do something like this: echo 'table'; echo 'tr'; while (...) { echo 'td$row['name']/tdtd$row['location']/tdtd$row['phone']/tdtd$row['fax']/td'; } echo '/tr'; echo '/table'; as opposed to this: $table-open_table(); while (...) { $table-new_row($row); } Of course it doesn't account for object, and the separate template file, but that is reusable. I don't know the syntax of smarty, but isn't it a similar thing? You define an HTML template and deliver the object contents upon rendering output? I have to look at Smarty more. I have used PHPBB which uses a symilar syntax (I think). I like that sort of template system. It seems logical to me. -Brian Kevin Waterson wrote: This one time, at band camp, Charlene Wroblewski [EMAIL PROTECTED] wrote: looked at Smarty and it doesn't seem to be as useful the way I'm using templates. I'm not surprised, 1000 lines of code to do hello world Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regex Help for URL's
Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header(Location: ... or Header(Refresh: 0;...
On Tue, May 16, 2006 10:48 am, Kevin Davies wrote: header (Refresh: 0; URL=cart.php?action=addid=$referencec=$catp=$page); exit; I don't think this is a real header -- just some made-up crapola from MS that works on most browsers, from the bully-pulpit principle. You'd have to read the HTTP specs for yourself to work it out... That said, if it's not working, then it's not working. Location: *DOES* work. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP daemons
On Tue, May 16, 2006 6:27 am, Martin Marques wrote: In the first daemon all I have to do to kill it is execute a pkill server_name. But with the new daemon (the object orientaded one) it doesn't die. After you pkill it, does it still work? Or is it a zombie? It's possible PHP's shutdown functions trying to close the sockets and destroy the instances have a bug... You could try to pastebin the code somewhere. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Sounds to me like your boot scripts are using a different httpd.conf than the one you are using when you re-start it by hand. Once you accept that proposition, you're looking at some OTHER issue in the by-hand httpd.conf that is screwing up the URLs, probably mod_rewrite or messed up VirtualHosts or... Well, it could be anything, really, but it's got nothing to do with PHP at that point. http://apache.org I personally stopped using apachectl script. I always use the boot script in /etc/ (or /usr/local/etc/ for BSD folks) because then at least I know I've got the same settings as I'm going to have on re-boot. On Tue, May 16, 2006 3:58 am, Mark Sargent wrote: Hi All, I get this, Not Found The requested URL /movie1.php was not found on this server. Apache/2.2.0 (Fedora) Server at localhost Port 80 when setting session.save_path to /tmp in /usr/local/lib/php.ini. Even if I change it back, I still get that error. Restarting httpd doesn't fix it. Only a reboot, ouch! Why is this happening? Cheers. httpd = 2.2.2 php = 5.1.4 OS = Fedora 5 Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a stdClass Object created with mimeDecode
On Tue, May 16, 2006 1:41 am, Stut wrote: [major snippage] it meets your requirements, but bear in mind that an email is not required to have a text/plain part. ... unless you actually want people to read it. HTML-only email will get nuked by spam filters and plain-text-only email readers. Don't do it. For that matter, even HTML-enhanced (cough, cough) email is much more likely to be IGNORED than a simple plain-text email. YMMV [and more snippage] -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help w/ 'headers already sent' and file download
On Mon, May 15, 2006 10:48 pm, Mike Walsh wrote: Is there a way to both display a web page and send content to be saved by the user? Not really really, but you can sort of hack it... If someone knows of an example I could look at I'd be greatful. Send out the HTML for the stats, and bury a META tag something like: META HTTP-EQUIV=REFRESH CONTENT=0;http://example.com/cached_results.csv; / Course, now you have to work out how to keep the CSV file around long enough for it to download, and not criss-cross the files and purge them when they are old and all that... But it will sort of work like you think you want. Another option would be to just display the stats and provide a download link for right-click to get the CSV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trouble sending data via TCP socket
On Mon, May 15, 2006 9:15 pm, J. King wrote: To further my understanding of how Jabber works I have decided I should try and write my own XMPP implementation in PHP. However, I've run into trouble rather quickly. To connect to a Jabber server, one must open a TCP socket to the server (typically through port 5269) send an XML-based stream header, wait for the server's confirmation and then log in, etc. As an initial test I tried to open a TCP socket, send a stream header, get the server's response, then disconnect. I did so thusly: $server = jabber.org; //example server $port = 5269; //default port $nsStream = http://etherx.jabber.org/streams;; // Streams namespace $socket = stream_socket_client(tcp://$server:$port); $header = stream:stream to='$server' xmlns='jabber:client' xmlns:stream='$nsClient' xml:lang='en' version='1.0'; You might maybe need a newline after all that. And I'd double-check that XML lets you use ' instead of for attribut values, or whatever they are called, cuz I've only ever seen that I can recall. fwrite($socket, $header); //send header echo stream_get_contents($socket); //get server confirmation //close connection fwrite($socket, /stream:stream); fclose($socket); I'm supposed to get something like this in reply (taken from my desktop Jabber client's debug window): ?xml version='1.0'? stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='4468F937' xmlns='jabber:client' from='jabber.org' Instead, I get this error message: stream:error invalid-namespace xmlns='urn:ietf:params:xml:ns:xmpp-streams'/ /stream:error That I get a conformant Jabber error message suggests that I -am- at least connecting to the server properly, but that the data is not getting to the server intact. I am certain that the XML header is correct: I also tested another PHP Jabber implementation[1] with the same result, even though a search of this mailing list suggests that said implementation has been known to work for other people. Since I tested it on two different machines (my home Windows computer and a Linux Dreamhost Web server) using three different versions of PHP (PHP 5.1.4 Winodws CLI, PHP 4.3.3 Windows CLI, PHP 5.1.1 Linux FastCGI), it's pretty clear that it's not a bug in the version of PHP I initially tested on. I also tried connecting to three different Jabber servers (my private dark-phantasy server, jabber.org, and a test Wildfire server on my colleague's machine) and all three gave me similar errors (with differing levels of spec compliance...). In short, I am stumped. If anyone with some experience in these matters could shed some light on my problem I would be most grateful. [1] http://cjphp.netflint.net/ -- J. King http://jking.dark-phantasy.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PECL install modify my php.ini? or even look at it?
On Tue, May 16, 2006 10:34 am, D. Dante Lorenso wrote: Richard Lynch wrote: On Thu, May 11, 2006 6:02 pm, D. Dante Lorenso wrote: pecl install memcache Is it possible that pecl has an --extension-dir flag to tell it WHERE to install stuff, or perhaps an optional command line arg or ... Cuz, really, the odds on it being where you want it to be are pretty slim. Odds would be increased if 'pecl' would look at what I've already declared in the PHP.ini file ;-) Okay, then you need to add a parameter to the command line to tell pecl where your php.ini file is, because it is *NOT* going to be in the place pecl thinks it will be on many many many machines. You haven't done anything but change the keywords and force pecl to dig through a php.ini file instead of just providing the info in the first place. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help for URL's
Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! so your looking for a regular expression that is *totally* different from the regular expression you have... the two have nothing in common. do you expect us to do the complete rewrite for you or do you want to learn abit about regexps yourself? (that probably sounds arrogant, so it might help to know even the most experienced people (a group I don't consider myself part of) here have [and do] get told to RTFM on occasion - no one is safe ;-) I suggest using a search engine to start with and see what that turns up... somehow I can't believe that nobody has ever written a regexp that matches urls, for instance try reading this page in the manual (hint: look at the the user notes) http://php.net/preg_match come back when/if you get stuck. preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's
Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions to be extremely difficult. Someone here might have the answer I need, and if so, I'd appreciate a response. If you don't know the answer, don't reply. Simple enough, don't you think? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 4:28 PM To: Robert Samuel White Cc: php-general@lists.php.net Subject: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! so your looking for a regular expression that is *totally* different from the regular expression you have... the two have nothing in common. do you expect us to do the complete rewrite for you or do you want to learn abit about regexps yourself? (that probably sounds arrogant, so it might help to know even the most experienced people (a group I don't consider myself part of) here have [and do] get told to RTFM on occasion - no one is safe ;-) I suggest using a search engine to start with and see what that turns up... somehow I can't believe that nobody has ever written a regexp that matches urls, for instance try reading this page in the manual (hint: look at the the user notes) http://php.net/preg_match come back when/if you get stuck. preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's
On Tue, 2006-05-16 at 16:31, Robert Samuel White wrote: Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions to be extremely difficult. Someone here might have the answer I need, and if so, I'd appreciate a response. If you don't know the answer, don't reply. Simple enough, don't you think? Perhaps a tad rude, but I got a treasure trove of hits from Google in my first shot: http://www.google.ca/search?hl=enq=regex+extract+urls+from+contentbtnG=Google+Searchmeta= Formulating a good search query is a great skill to hone. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 404 errors
I get a lot of 404 errors. Is there a way in PHP to redirect them in such a way as it does not burn my bandwidth? Or (an Apache trick I learned once) to discourage them by referring them to localhost? Or something? Something I can embed in PHP. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help for URL's
Robert Samuel White wrote: Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions to be extremely difficult. Someone here might have the answer I need, and if so, I'd appreciate a response. If you don't know the answer, don't reply. Simple enough, don't you think? What's simple is a Google search. If you don't want to do the leg work, don't ask us to do it for. Simple enough, don't you think. Because it makes the email hard to read. Why is top posting bad? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 4:28 PM To: Robert Samuel White Cc: php-general@lists.php.net Subject: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! so your looking for a regular expression that is *totally* different from the regular expression you have... the two have nothing in common. do you expect us to do the complete rewrite for you or do you want to learn abit about regexps yourself? (that probably sounds arrogant, so it might help to know even the most experienced people (a group I don't consider myself part of) here have [and do] get told to RTFM on occasion - no one is safe ;-) I suggest using a search engine to start with and see what that turns up... somehow I can't believe that nobody has ever written a regexp that matches urls, for instance try reading this page in the manual (hint: look at the the user notes) http://php.net/preg_match come back when/if you get stuck. preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a stdClass Object created with mimeDecode
Richard Lynch wrote: On Tue, May 16, 2006 1:41 am, Stut wrote: it meets your requirements, but bear in mind that an email is not required to have a text/plain part. ... unless you actually want people to read it. HTML-only email will get nuked by spam filters and plain-text-only email readers. Don't do it. For that matter, even HTML-enhanced (cough, cough) email is much more likely to be IGNORED than a simple plain-text email. Absolutely true, I agree 100%. However, in this situation we're on the other end of the line where we don't control the email creation but we need to deal with it in whatever format it arrives in. The simple fact is that email is not required to contain a text/plain part, so it's not an assumption that is safe to make. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PECL install modify my php.ini? or even look at it?
Richard Lynch wrote: On Tue, May 16, 2006 10:34 am, D. Dante Lorenso wrote: Richard Lynch wrote: On Thu, May 11, 2006 6:02 pm, D. Dante Lorenso wrote: pecl install memcache s it possible that pecl has an --extension-dir flag to tell it WHERE to install stuff, or perhaps an optional command line arg or ... Cuz, really, the odds on it being where you want it to be are pretty slim. Odds would be increased if 'pecl' would look at what I've already declared in the PHP.ini file ;-) Okay, then you need to add a parameter to the command line to tell pecl where your php.ini file is, because it is *NOT* going to be in the place pecl thinks it will be on many many many machines. /usr/bin/php knows where the php.ini file is and /usr/bin/pecl is written in PHP. It boils down to an ini_get() call. Sounds like your fear of not knowing where the php.ini file is located is already alleviated. You haven't done anything but change the keywords and force pecl to dig through a php.ini file instead of just providing the info in the first place. Digging through an ini file? I know you aren't trying to tell me that this is difficult drudgery. php already digs/dug through the php.ini file and yes, if I have to provide another command-line argument for something that is already known THAT is drudgery. But let's not argue this. I've just adopted the default pecl extension dir as my php.ini value so MY problem is solved, but for simple academic debate, I think pecl could/should be smarter (especially if you actually WANT developers to use it). Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 errors
John Taylor-Johnston wrote: I get a lot of 404 errors. Is there a way in PHP to redirect them in such a way as it does not burn my bandwidth? Or (an Apache trick I learned once) to discourage them by referring them to localhost? Or something? Something I can embed in PHP. IMHO unless there's a very good reason for it PHP should never get involved in handling 404 errors. By the time it gets to PHP it's wasted a fair amount of capacity. On most of my sites, where I don't need to handle 404's intelligently (i.e. showing a search results page based on the entered URL) I use the following in the apache configuration... ErrorDocument 404 404 Not Found That simply makes PHP return 404 Not Found which is about the minimum amount of bandwidth you can get away with. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's
I am trying to get all of the urls in a web document, so that I can append information to the urls when needed (when the url points to a domain that resides on my server). It allows me to pass session information across the domains of my network. Currently, I use a class I wrote to handle this, but it only works when it finds the urls in a standard html tag. I need to expand upon this, so that it also finds urls that are in onclick events, for example. Here is a sample page from my website: SCRIPT LANGUAGE=JavaScriptif (parent != self) top.location.href = location.href;/SCRIPTTABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0 ALIGN=CENTER CLASS=TEMPLATE-TABLETRTD COLSPAN=7 CLASS=TEMPLATE-TABLE-TOP TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100% HEIGHT=48 TR TD WIDTH=60 ROWSPAN=2 ALIGN=RIGHTIMG SRC=http://www.enetwizard.info/shared/enetwizard.gif; WIDTH=46 HEIGHT=46 BORDER=0 ALT= //TD TD HEIGHT=24 VALIGN=BOTTOMDIV STYLE=font-family: sans-serif; font-size: 8pt; font-weight: bold; color: white; margin-left: 10px;eNetwizard, Inc./DIV/TD TD HEIGHT=24 VALIGN=BOTTOM ALIGN=RIGHTDIV STYLE=font-family: sans-serif; font-size: 8pt; color: #FF; font-weight: bold; margin-right: 20px; Anonymous Visitornbsp;nbsp;|nbsp;nbsp;A HREF=http://www.enetwizard.cc/security.wizard?asset=welcomeamp;process=log inamp;form=login STYLE=font-family: sans-serif; font-size: 8pt; color: #6BDB17; font-weight: bold; text-decoration: underline;Log In/Anbsp;nbsp;|nbsp;nbsp;A HREF=http://www.enetwizard.cc/security.wizard?asset=welcomeamp;process=sig nupamp;form=signup STYLE=font-family: sans-serif; font-size: 8pt; color: #6BDB17; font-weight: bold; text-decoration: underline;Sign Up/A /DIV/TD /TRTR TD HEIGHT=24 VALIGN=TOPDIV STYLE=font-family: sans-serif; font-size: 8pt; color: white; margin-left: 10px;IEmpowering Your Creativity./I/DIV/TD TD HEIGHT=24 VALIGN=TOP ALIGN=RIGHTDIV STYLE=font-family: sans-serif; font-size: 8pt; color: #FF; margin-right: 20px; ITuesday, May 16, 2006/I /DIV/TD /TR /TABLE /TD/TRTRTD COLSPAN=7 STYLE=height: 20px;DIV STYLE=font-size: 1px;nbsp;/DIV/TD/TRTRTD VALIGN=TOP STYLE=width: 20px;DIV STYLE=font-size: 1px;nbsp;/DIV/TDTD VALIGN=TOP CLASS=TEMPLATE-TABLE-LEFT STYLE=width: 180px;TABLE CLASS=RSW-TABLETR CLASS=RSW-TABLE-HEAD-TRTD CLASS=RSW-TABLE-HEAD-TDDIV CLASS=RSW-DIV-HEAD-CENTERSPAN CLASS=RSW-FONT-HEAD-TEXTeNetwizard, Inc./SPAN/DIV/TD/TRTR CLASS=RSW-TABLE-ROW1-TRTD CLASS=RSW-TABLE-ROW1-TD ONMOUSEOVER=this.className = 'RSW-TABLE-SEP1-TD'; window.status = 'Backend Manager'; return true; ONMOUSEOUT=this.className = 'RSW-TABLE-ROW1-TD'; window.status = ''; return true; ONCLICK=location.href = 'http://www.enetwizard.be/default.rsw'; return true; STYLE=cursor: pointer;DIV CLASS=RSW-DIV-ROW1-LEFTSPAN CLASS=RSW-FONT-ROW1-TEXTA CLASS=RSW-FONT-ROW1-LINK HREF=http://www.enetwizard.be/default.rsw; ONMOUSEOVER=window.status = 'Backend Manager'; return true; ONMOUSEOUT=window.status = ''; return true;Backend Manager/ABReNetwizard.be/SPAN/DIV/TD/TRTR CLASS=RSW-TABLE-ROW2-TRTD CLASS=RSW-TABLE-ROW2-TD ONMOUSEOVER=this.className = 'RSW-TABLE-SEP2-TD'; window.status = 'Business Headquarters'; return true; ONMOUSEOUT=this.className = 'RSW-TABLE-ROW2-TD'; window.status = ''; return true; ONCLICK=location.href = 'http://www.enetwizard.biz/default.rsw'; return true; STYLE=cursor: pointer;DIV CLASS=RSW-DIV-ROW2-LEFTSPAN CLASS=RSW-FONT-ROW2-TEXTA CLASS=RSW-FONT-ROW2-LINK HREF=http://www.enetwizard.biz/default.rsw; ONMOUSEOVER=window.status = 'Business Headquarters'; return true; ONMOUSEOUT=window.status = ''; return true;Business Headquarters/ABReNetwizard.biz/SPAN/DIV/TD/TRTR CLASS=RSW-TABLE-SEP1-TRTD CLASS=RSW-TABLE-SEP1-TD ONMOUSEOVER=this.className = 'RSW-TABLE-SEP1-TD'; window.status = 'Client Control Center'; return true; ONMOUSEOUT=this.className = 'RSW-TABLE-SEP1-TD'; window.status = ''; return true; ONCLICK=location.href = 'http://www.enetwizard.cc/default.rsw'; return true; STYLE=cursor: pointer;DIV CLASS=RSW-DIV-SEP1-LEFTSPAN CLASS=RSW-FONT-SEP1-TEXTA CLASS=RSW-FONT-SEP1-LINK HREF=http://www.enetwizard.cc/default.rsw; ONMOUSEOVER=window.status = 'Client Control Center'; return true; ONMOUSEOUT=window.status = ''; return true;Client Control Center/ABReNetwizard.cc/SPAN/DIV/TD/TRTR CLASS=RSW-TABLE-ROW2-TRTD CLASS=RSW-TABLE-ROW2-TD ONMOUSEOVER=this.className = 'RSW-TABLE-SEP2-TD'; window.status = 'Development Services'; return true; ONMOUSEOUT=this.className = 'RSW-TABLE-ROW2-TD'; window.status = ''; return true; ONCLICK=location.href = 'http://www.enetwizard.de/default.rsw'; return true; STYLE=cursor: pointer;DIV CLASS=RSW-DIV-ROW2-LEFTSPAN CLASS=RSW-FONT-ROW2-TEXTA CLASS=RSW-FONT-ROW2-LINK HREF=http://www.enetwizard.de/default.rsw; ONMOUSEOVER=window.status = 'Development Services'; return true; ONMOUSEOUT=window.status = ''; return true;Development Services/ABReNetwizard.de/SPAN/DIV/TD/TRTR CLASS=RSW-TABLE-ROW1-TRTD CLASS=RSW-TABLE-ROW1-TD ONMOUSEOVER=this.className = 'RSW-TABLE-SEP1-TD'; window.status =
Re: [PHP] Regex Help for URL's
Robert Samuel White wrote: Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions to be extremely difficult. Someone here might have the answer I need, and if so, I'd appreciate a response. If you don't know the answer, don't reply. Simple enough, don't you think? I wasn't being rude. Although even If I was commanding me stop is rather futile no? if I was being rude I would have said something like: read http://php.net/preg_match and find the get_links() function posted by 'max99x [at] gmail [dot] com' you f*** wit now that would have been rude. the argument that the length of time spent programming automatically makes you 'not a slacker' is unbased. one does not equate the other. personally I would assume anyone who had been programming for 20 yrs would have a reasonable understanding of regexps. -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 4:28 PM To: Robert Samuel White Cc: php-general@lists.php.net Subject: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! so your looking for a regular expression that is *totally* different from the regular expression you have... the two have nothing in common. do you expect us to do the complete rewrite for you or do you want to learn abit about regexps yourself? (that probably sounds arrogant, so it might help to know even the most experienced people (a group I don't consider myself part of) here have [and do] get told to RTFM on occasion - no one is safe ;-) I suggest using a search engine to start with and see what that turns up... somehow I can't believe that nobody has ever written a regexp that matches urls, for instance try reading this page in the manual (hint: look at the the user notes) http://php.net/preg_match come back when/if you get stuck. preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 16 May 2006 21:32 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions to be extremely difficult. Someone here might have the answer I need, and if so, I'd appreciate a response. If you don't know the answer, don't reply. Simple enough, don't you think? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 4:28 PM To: Robert Samuel White Cc: php-general@lists.php.net Subject: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this: http(s)://x.y.z.domain.com/dir/dir/file.name.ext?query=1query=2#anchor Any help would be greatly appreciated! so your looking for a regular expression that is *totally* different from the regular expression you have... the two have nothing in common. do you expect us to do the complete rewrite for you or do you want to learn abit about regexps yourself? (that probably sounds arrogant, so it might help to know even the most experienced people (a group I don't consider myself part of) here have [and do] get told to RTFM on occasion - no one is safe ;-) I suggest using a search engine to start with and see what that turns up... somehow I can't believe that nobody has ever written a regexp that matches urls, for instance try reading this page in the manual (hint: look at the the user notes) http://php.net/preg_match come back when/if you get stuck. preg_match_all('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', $arcContent, $tmpMatches); $arcContent = preg_replace('#\[LEVEL([0-9])\](.*)\[/LEVEL[0-9]]#Uim', '###URL###', $arcContent); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1541 (20060516) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Bearing in mind that none of the replies (particularly that of Jochem, one of the posters that should be held in high regard) have been rude in any way at all, I understand your plight with regex's You might want to try the Regex Coach... It allows you to test your regex's offline and can really help http://www.weitz.de/regex-coach/ HTH Dan Personal note: Stop using Lookout... it sucks -- http://chrome.me.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
In case any one is looking for a solution to a similar problem as me, here is the answer. I used the code from my original post as my guiding light, and with some experimentation, I figured it out. To get any URL, regardless of where it is located, use this: preg_match_all(#\'http://(.*)\'#U, $content, $matches); This match anything similar to: 'http://www.domain.com/dir/dir/file.txt?query=blah' This is useful, if for example, you have a tag like this one: A HREF=javascript:void(0); ONCLICK=javascript:window.open = 'http://www.domain.com/dir/dir/file.txt?query=blah'; Now, for tags which are in quotes, rather than single quotes, just use: preg_match_all(#\http://(.*)\#U, $content, $matches); This is really only the first step. In order to be useful, you need a way to process these urls according to your own specific needs: preg_match_all(#\'http://(.*)\'#U, $content, $matches); $content = preg_replace(#\'http://(.*)\'#U, '###URL###', $content); This will modify the $content variable to change all urls to ###URL### You can then go through them one at a time to process them: for ($count = 0; $count count($matches[1]); $count++) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote: In case any one is looking for a solution to a similar problem as me, here is the answer. I used the code from my original post as my guiding light, and with some experimentation, I figured it out. To get any URL, regardless of where it is located, use this: preg_match_all(#\'http://(.*)\'#U, $content, $matches); This match anything similar to: 'http://www.domain.com/dir/dir/file.txt?query=blah' This is useful, if for example, you have a tag like this one: A HREF=javascript:void(0); ONCLICK=javascript:window.open = 'http://www.domain.com/dir/dir/file.txt?query=blah'; Now, for tags which are in quotes, rather than single quotes, just use: preg_match_all(#\http://(.*)\#U, $content, $matches); I'd roll those two into one expression: preg_match_all(#(\|')http://(.*)(\|')#U, $content, $matches); Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
On Tue, May 16, 2006 6:21 pm, Robert Cummings wrote: On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote: In case any one is looking for a solution to a similar problem as me, here preg_match_all(#(\|')http://(.*)(\|')#U, $content, $matches); And it's missing the original requirement of matching https URLs, so maybe make it be ...https?://... Plus, http could be IN CAPS, so change the U to iU And, actually, SOME old-school HTML pages will have neither ' nor around the URL, and are (or were) valid: href=page2.html was considered valid for HTML for a long long long time So toss in (\|')? And then you may be finding URLs that are not actually linked but are part of the visible content, so maybe you only want the ones that have a[^]href= in front of them. If I can toss off 3 problems without even trying... So I still think Google or searching the archives (as I suggested off-list) will be the quickest route to a CORRECT answer, but here we are again in this same thread we've been in every month or so for the better part of a decade... PS the (\|') bit may move the URLs into $matches[2] instead of $matches[1] or whatever. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does PECL install modify my php.ini? or even look at it?
On Tue, May 16, 2006 4:07 pm, D. Dante Lorenso wrote: Richard Lynch wrote: On Tue, May 16, 2006 10:34 am, D. Dante Lorenso wrote: Richard Lynch wrote: On Thu, May 11, 2006 6:02 pm, D. Dante Lorenso wrote: pecl install memcache s it possible that pecl has an --extension-dir flag to tell it WHERE to install stuff, or perhaps an optional command line arg or ... Cuz, really, the odds on it being where you want it to be are pretty slim. Odds would be increased if 'pecl' would look at what I've already declared in the PHP.ini file ;-) Okay, then you need to add a parameter to the command line to tell pecl where your php.ini file is, because it is *NOT* going to be in the place pecl thinks it will be on many many many machines. /usr/bin/php knows where the php.ini file is and /usr/bin/pecl is written in PHP. It boils down to an ini_get() call. Sounds like your fear of not knowing where the php.ini file is located is already alleviated. /usr/bin/php might know where the php.ini file which was compiled into the CLI php lives, but that could easily have nothing to do with where the HTTP php.ini lives, since one may have quite different php.ini for those two scenarios of CLI and HTTP The security needs alone of HTTP versus CGI versus CLI are quite different. For that matter, in more recent versions, the compiled-in value for CLI could match the compiled-in value for HTTP, and it STILL could be wrong because there is an Apache directive to tell PHP where to look for php.ini which overrides the compiled-in default under HTTP. Not to mention that I could easily, and, in point of fact, DO HAVE, mutliple php.ini files for use with CLI php for various circumstances, none of which match up with the php.ini used for HTTP. And it's entirely possible that I would want to install my new pecl module only in a particular installation of PHP. Did I mention that I also need to run one version of PHP from a snapshot which needs yet another php.ini because of a patch? Oh, and also, it's perfectly common for the CLI php install to have no php.ini file at all, and to be running from the default defaults (sic) which (used to ?) match the php.ini-dist settings if you didn't copy php.ini-dist as instructed in the install documentation. It's also not uncommon for the HTTP install to not have an actual php.ini file, for that matter. If you think all of this doesn't matter, or only applies to experts, you've clearly not been through the joy of the Great php.ini Hunt with an inexperienced user, not to mention dealt with Windows/IIS where you're pretty much STUCK with whatever php.ini value was randomly-selected [1] by the Windows release bundler person, and which could easily not match the one bundled into the first php.exe encountered in the MS-DOS shell $PATH variable, if they've ever re-installed PHP. [1] I exaggerate. It's not randomly-selected. It's just very very very inconsistent and depends entirely on who felt like compiling the Windows archive this day/week/month/year/version. The effect, however, is about the same as it being random, since it could easily be any one of: C:\php C:\php4 C:\php5 C:\Windows\System\ C:\Windows\System32\ . . . -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
All pages used by my content management system must be in a valid format. Old-school style pages are never created so the solution I have come up with is perfect for my needs. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 errors
On Tue, May 16, 2006 3:56 pm, John Taylor-Johnston wrote: I get a lot of 404 errors. Is there a way in PHP to redirect them in such a way as it does not burn my bandwidth? Or (an Apache trick I learned once) to discourage them by referring them to localhost? Or something? Something I can embed in PHP. header(Location: 127.0.0.1); would be the PHP equivalent of that Apache trick. Not sure how effective it is... Another option is to do this: ?php if (bad_user()){ sleep(mt_rand(1, 60)); } ? You have to figure out a way to code bad_user() to only catch the bad guys, but they'll decide your server is too slow to be useful, or that they've trashed it with their DOS attack, and move on to another victim. Honestly, though, PHP is almost-for-sure the wrong place to attack this problem... Not saying I know what is the RIGHT place, mind. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:16 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] All pages used by my content management system must be in a valid format. Old-school style pages are never created so the solution I have come up with is perfect for my needs. Thank you. Doesn't that make it a proprietary solution? IMHO offering the regex may create a false situation for people... So the answer may not be for everyone Might be wrong :) Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Help for URL's
On Tue, May 16, 2006 4:22 pm, Jochem Maas wrote: personally I would assume anyone who had been programming for 20 yrs would have a reasonable understanding of regexps. Nope. :-) I got WAY past 20 year mark before I even began to pretend to understand the minimal amount of regex I can do now. Most things complicated enough to need regex are too complicated to do with regex, if you know what I mean... There's a very narrow band of problems where I'm comfy with regex, really. Anything simpler than that is just a substr or explode. Anything more complicated, and I just don't want to try to maintain the mess of not-quite-random characters needed to make a so-called pattern and I'll find some other way to break the problem down into sub-problems. Those sub-problems might then be amenable to a reasonable regex, of course, but I'm just not gonna tackle it in one big messy pattern. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
In my opinion, it is the most reasonable solution. I have looked all over the web for something else, but this works perfectly for me. It's impossible to tell where an url starts and ends if you don't have it in quotes or single quotes. If someone really needs to find all the urls in a page, then they'll code their pages to make use of this limitation. -Original Message- From: Chrome [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 8:24 PM To: 'Robert Samuel White'; php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] -Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:16 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] All pages used by my content management system must be in a valid format. Old-school style pages are never created so the solution I have come up with is perfect for my needs. Thank you. Doesn't that make it a proprietary solution? IMHO offering the regex may create a false situation for people... So the answer may not be for everyone Might be wrong :) Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:28 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] In my opinion, it is the most reasonable solution. I have looked all over the web for something else, but this works perfectly for me. It's impossible to tell where an url starts and ends if you don't have it in quotes or single quotes. If someone really needs to find all the urls in a page, then they'll code their pages to make use of this limitation. -Original Message- From: Chrome [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 8:24 PM To: 'Robert Samuel White'; php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] -Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:16 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] All pages used by my content management system must be in a valid format. Old-school style pages are never created so the solution I have come up with is perfect for my needs. Thank you. Doesn't that make it a proprietary solution? IMHO offering the regex may create a false situation for people... So the answer may not be for everyone Might be wrong :) Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1542 (20060516) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com If we are talking clickable links, why not focus on the a construct itself? Otherwise URLs are just part of the page's textual content... Very difficult to parse that Disseminating an a tag isn't brain-meltingly difficult with a regex if you put your mind to it... With or without quotes, be they single, double or non-existent If I've misunderstood please chastise me :) HTH Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
If we are talking clickable links, why not focus on the a construct itself? Otherwise URLs are just part of the page's textual content... Very difficult to parse that Disseminating an a tag isn't brain-meltingly difficult with a regex if you put your mind to it... With or without quotes, be they single, double or non-existent If I've misunderstood please chastise me :) HTH Dan Dan, That's what I was doing. I was parsing A:HREF, IMG:SRC, etc. But when I implemented a new feature on my network, where you could click on a row and have it take you to another domain, I need a better solution. Go to http://www.enetwizard.ws and it might make more sense. All the links on the left have an ONCLICK=location.href = '' attribute in the TR tag. This solution allowed me to make sure those links included the session information, just like the A:HREF links do. It also had the advantage of updating the links in my CSS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Help for URL's [ANSWER]
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:42 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] If we are talking clickable links, why not focus on the a construct itself? Otherwise URLs are just part of the page's textual content... Very difficult to parse that Disseminating an a tag isn't brain-meltingly difficult with a regex if you put your mind to it... With or without quotes, be they single, double or non-existent If I've misunderstood please chastise me :) HTH Dan Dan, That's what I was doing. I was parsing A:HREF, IMG:SRC, etc. But when I implemented a new feature on my network, where you could click on a row and have it take you to another domain, I need a better solution. Go to http://www.enetwizard.ws and it might make more sense. All the links on the left have an ONCLICK=location.href = '' attribute in the TR tag. This solution allowed me to make sure those links included the session information, just like the A:HREF links do. It also had the advantage of updating the links in my CSS. O that breaks accessibility standards! Compliment the 'onclick's with onkeydown at least :) But still you get a solid onclick=... scenario If these are visible in the source then they are fairly easy to pick out Though you may need more than 1 regex ;) My complaint here is, don't break accessibility :) Dan -- http://chrome.me.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Jochem Maas wrote: NO - DONT EVER DO THIS tmp/session files should not be stored in a directory that can be [potentially] read via http. .htaccess directives can be used to block access to the dir BUT I still would recommend keeping 'tmp' outside of the web root. just make sure 'tmp' is writable by the user the webserver is running as. Hi All, thanx. How do I determine what user httpd is running as? Cheers. Mark Sargent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Mark Sargent wrote: Jochem Maas wrote: NO - DONT EVER DO THIS tmp/session files should not be stored in a directory that can be [potentially] read via http. .htaccess directives can be used to block access to the dir BUT I still would recommend keeping 'tmp' outside of the web root. just make sure 'tmp' is writable by the user the webserver is running as. Hi All, thanx. How do I determine what user httpd is running as? Cheers. Edit your httpd.conf file and look for user and group. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Mark Sargent wrote: Jochem Maas wrote: NO - DONT EVER DO THIS tmp/session files should not be stored in a directory that can be [potentially] read via http. .htaccess directives can be used to block access to the dir BUT I still would recommend keeping 'tmp' outside of the web root. just make sure 'tmp' is writable by the user the webserver is running as. Hi All, thanx. How do I determine what user httpd is running as? Cheers. I should say check your httpd.conf file for User and Group - they are capitalized. Alternatively: ps aux | grep httpd or ps aux | grep apache the first column is the user it's running as. or lastly, probably the quickest way, create a phpinfo page and look for User/Group -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Narorwed down my problem to one statement:
$sql = INSERT INTO BOOKS(CopyrightYear,CoverType,DatePurchased,EditionNumber,ISBNNumber,Notes,Pages,Publisher,LOCNumber) VALUES(\ . $_POST[copyrightyear] . \,\ . $_POST[covertype] . \,\ . $_POST[datepurchased] . \, . $_POST[editionnumber] . ,\ . $_POST[isbn] . \,\ . addslashes($_POST[notes]) . \, . (isset($_POST[numberofpages])?$_POST[numberofpages]:0) . ,\ . $_POST[publisher] . \,\ . $_POST[locnumber] . \); Okay, when $_POST[notes] contains quotes, it seems to break the series, ie returns an error at that point of the SQL statement, even with addslashes(), am I doing something wrong there? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPEditIni now supports Linux/Unix
The PHPEditIni PHP script now supports Linux/Unix. Use this script to edit your PHP.INI files in a browser based GUI. Visit http://phpeditini.net . -- The PHP EditIni Project [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 After Setting session.save_path to /tmp
Chris wrote: I should say check your httpd.conf file for User and Group - they are capitalized. Alternatively: ps aux | grep httpd yes, did that one and see it as starting as root, then goijg to daemon. Now, if I add daemon to the root group, isn't that a security issue? Should I create a new group? Little confused? Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php