[PHP] Re: Downloading utf-8 encoded files
On Tue, 26 Dec 2006 17:22:39 +0500, Fahad Pervaiz wrote: I want to download UTF-8 encoded kml files from a website. I have written a script that automatically downloads KML file. Problem is that some of the utf-8 charc are distrubed after saving file on windows. below is the script. $handle = fopen($link, rb); $handle2= fopen(kml/$i.kml,w); Using binary mode in both streams might help: $handle2= fopen(kml/$i.kml,wb); --nfe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read cwk files
Hi, I need to read cwk files (mac clarisworks files). so is it possible to do so using php if so how to do that? Thanks. _ Get FREE Web site and company branded e-mail from Microsoft Office Live http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: http request problem
On 1/3/07, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2007-01-03 11:19:21 +0500: ===ORINGIAL=== [...] ===END ORIGINAL=== Gah, early morning! Ok, I wasted my time thanks to your quoting style. Would you please use something more conventional, like prefixing each line of the quoted material with ? Thank you! I had the same problem. I tried following code but it gives the same error $link= http://123.123.1.2:8008/V3JRoute?slot=1startX=103.880764startY=1.335458endX=103.886297endY=1.334953routeType=1format=2 ; $handle2= fopen($link,r); ... Seriosly: does that mean that your original question is answered, or do you still expect advice on getting it to work? I really can't tell, there's neither a question nor a solved statement in your email. It all is in Kencana's (the original author) shoes right now i dont know what to advise other than what has been provided to figure out such an odd error. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing a file to the browser
roman neuhauser describes it rather well on the other thread. Basically. the push in this context below, is the response php provides php.net/header has a lot of info about how to send a non html file back to the browser. Curt. On 1/2/07, Casey Chu [EMAIL PROTECTED] wrote: What do you mean by `pushing`? On 9/15/06, Mike Mannakee [EMAIL PROTECTED] wrote: Hello, I have a script I've created which takes a file upload, monkeys with the data in it, and needs to push the new file out to the browser. Everything is coded and working up to that last point, but I've never pushed out a file to the browser before. Does anyone have the code for this laying around that I can see (and modify)? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read cwk files
On 1/3/07, John Salib [EMAIL PROTECTED] wrote: Hi, I need to read cwk files (mac clarisworks files). so is it possible to do so using php if so how to do that? Sure you can read the files, the question is what is the output you want it in? Once that is answered, is there such a tool i can use to do that? Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: http request problem
Hi all, first of all, sorry for all the trouble i have caused. i didnt give a clear explanation and for your information that I am not the author of the requested jsp file. however i did try to access other jsp file from the same server, it didn't give me any error. so i guess i have to ask the author about this issue. and once again I am really sorry for the trouble Regards, Kencana Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 11:19:21 +0500: ===ORINGIAL=== hi all, I got problem in getting file content. the file is located at another server (tomcat) and it is a jsp file. i don't know why i keep getting the same error message file accessing that file but while i am trying to access to another file, from another server it run perfect. this is the error message i get: PHP Warning: file_get_contents( http://123.123.1.2:8008/V3JRoute?slot=1startX=103.880764startY=1.335458endX=103.886297endY=1.334953routeType=1format=2 ) [function.file-get-contents]: failed to open stream: HTTP request failed! $5$13:53:22,13:53:22,13:53:22,13:53:22,13:53:22$0.0,0.0,0.0,0.0,0.0$Depart on,Turn sharp left onto,Continue on,Turn right onto in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\phpviewersample\xmlaccesstrial.php on line 5 take note that the text in bold is part of the page contents. The text/plain version of your multipart/mixed email omits terminal escape sequences (tags) so there's no bold. But that error message is somehow garbled anyway. Now, what happens if you try to display that same url in a normal browser on the same network where it fails in the PHP script? If it works, what's the difference between the two requests? Use a packet capture and analysis tool like Wireshark (formerly Ethereal) to tell. If it doesn't work, fix that first. If it works from a normal browser, you can't see anything wrong with the request made by PHP, *and* you know your requests actually hit the server, ask its admin to cooperate. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/http-request-problem-tf2911952.html#a8137855 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read cwk files
well I mean I want to fetch the data from it. I need to get the data in plain text format. formating is not important. I found a script to do that for xls files but didn't find one for cwk files. From: Curt Zirzow [EMAIL PROTECTED] To: John Salib [EMAIL PROTECTED] CC: php-general@lists.php.net Subject: Re: [PHP] read cwk files Date: Wed, 3 Jan 2007 00:58:47 -0800 On 1/3/07, John Salib [EMAIL PROTECTED] wrote: Hi, I need to read cwk files (mac clarisworks files). so is it possible to do so using php if so how to do that? Sure you can read the files, the question is what is the output you want it in? Once that is answered, is there such a tool i can use to do that? Curt. _ Fixing up the home? Live Search can help http://imagine-windowslive.com/search/kits/default.aspx?kit=improvelocale=en-USsource=hmemailtaglinenov06FORM=WLMTAG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read cwk files
On 1/3/07, John Salib [EMAIL PROTECTED] wrote: well I mean I want to fetch the data from it. I need to get the data in plain text format. formating is not important. I found a script to do that for xls files but didn't find one for cwk files. This might be hard to find, do you have the ability to export it into a more standard format like cvs? Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read cwk files
On 1/3/07, Curt Zirzow [EMAIL PROTECTED] wrote: On 1/3/07, John Salib [EMAIL PROTECTED] wrote: well I mean I want to fetch the data from it. I need to get the data in plain text format. formating is not important. I found a script to do that for xls files but didn't find one for cwk files. This might be hard to find, do you have the ability to export it into a more standard format like cvs? I mean CSV. Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
# [EMAIL PROTECTED] / 2007-01-03 11:14:27 +0100: When I send mail via PEARs Mail class they are sorted as spam by Thunderbird. Do you have any ideas why? I can't figure it out. Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR mail sorted as spam
Hi, When I send mail via PEARs Mail class they are sorted as spam by Thunderbird. Do you have any ideas why? I can't figure it out. function send_mail($to,$from,$subject,$body) { $recipients = $to; $headers = array(); $headers['From']= $from; $headers['To'] = $to; $headers['Subject'] = $subject; $params[host] = my.smtp.com; $mail_object = Mail::factory('smtp', $params); $mail_object-send($recipients, $headers, $body); } -- Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Hi, I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. Maybe I haven't included some header non-spam usually have or something? Did my script look all okey? Emil Roman Neuhauser wrote: Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? -- Hälsningar Emil Edeholt Karlsson Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Emil Edeholt wrote: Hi, I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. Maybe I haven't included some header non-spam usually have or something? Did my script look all okey? it's not the script. it's the content of the email (possibly in conjunction with 'bad' mail headers, etc) Emil Roman Neuhauser wrote: Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Are you sure? The email is very short and is something like this (but in swedish): Hello, Your order is now available. Regards Emil Jochem Maas wrote: it's not the script. it's the content of the email (possibly in conjunction with 'bad' mail headers, etc) -- Hälsningar Emil Edeholt Karlsson Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Emil Edeholt wrote: I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. Maybe I haven't included some header non-spam usually have or something? Did my script look all okey? Let's all take a moment and thank $DEITY that there is no non-spam header. Anyway, moving on... Whether an email is marked as spam or not depends on a lot of factors. Check the archives - this has been discussed a few times in the past few months. -Stut Roman Neuhauser wrote: Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Emil Edeholt wrote: Are you sure? The email is very short and is something like this (but in yes I'm sure. Thunderbird knows nothing about your script (not even that it exists), all it sees is the 'envelope' (headers et al) and the content of the email. it might be purely the fact that the email is so short, or it may even be due to the language in the email - hard to say without doing some proper testing (i.e. create variations of the email, etc - also read up on how to avoid being marked as spam when sending email - thedre is plenty of advice out there). PS - 'something like this' generally equates to 'completely useful information' when it comes to solving programming problems - be specific and detailed, hard facts are all that count in this game ;-) swedish): Hello, Your order is now available. Regards Emil Jochem Maas wrote: it's not the script. it's the content of the email (possibly in conjunction with 'bad' mail headers, etc) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-02 21:23:02 +0100: David CHANIAL wrote: We are preparing the upgrade of PHP for our customers, but, after some tests, we have a migration problem caused by the news E_RECOVERABLE_ERROR. So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about the method to handle this new errors (by using try/catch), they don't talk there is no mention of try/catch - it seems that the rather unfortunate word 'catchable' was used to describe the act of setting up a user defined error handler (see: http://php.net/manual/en/function.set-error-handler.php) to handle errors that are triggered by the php core. [errors != exceptions] Unfortunately. Consider this: function f($any) { printf(%s\n, $any); } Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object without __toString(). The 5.2.0 changelog talks about problems with the textual representation (object #id), but this cure is IMO worse than the disease, especially as they didn't make it an exception which would be *much* easier to handle: function f($any) { try { printf(%s\n, $any); } catch (CastError $e) { printf(%s\n, spl_object_hash($any)); } } In fact, I wonder why spl_object_hash() hasn't replaced the old default behavior. One way to (almost) handle this (or indeed warnings in PHP at all) is to use an error_handler that mutates all it can into exceptions. Unfortunately, you can only do this if there's no independently developed code in the program. If it uses a library that's not written for a throwing error handler, such a handler will change the library's semantics! Imagine a DB library that contained this code: if (false === ($conn = mysql_connect())) { handle_error(); } handle_error() will never be called with a throwing error handler. And you cannot use such a handler in the library either, because the application would have to defend against the library error handler leaking e. g. into signal handlers. Also, if every library had to install/deinstall its own error handler on every entry and exit of its code... I don't want to even think of that. To me, E_RECOVERABLE_ERROR, or at least some of its instances, seem to be more of an interoperability problem than anything else. But that's IMO true of the whole error handling in PHP. Now back to our regularly scheduled pushing files around t3h 1nt3rn3t. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Project php-mobile
Hello, I am a PHP-Developer, and for a long time I wait for um php binary for PDA's (mobiles devices). But this time not hapen. So I and my friend Lauro Salmito (C develeper) making the PHP-Mobile Project. We want create a small binary, Mobile Edition. Basically we make a binary with the fallowing features: - Language Reference http://www.php.net/manual/en/langref.php; - Function Reference http://www.php.net/manual/en/funcref.php - V. Array Functionshttp://www.php.net/manual/en/ref.array.php - XII. Class/Object Functionshttp://www.php.net/manual/en/ref.classobj.php - XXII. Date and Time Functionshttp://www.php.net/manual/en/ref.datetime.php - XXIX. Directory Functionshttp://www.php.net/manual/en/ref.dir.php - XL. Filesystem Functionshttp://www.php.net/manual/en/ref.filesystem.php - XLVI. FTP Functions http://www.php.net/manual/en/ref.ftp.php - XCV. MySQL Functionshttp://www.php.net/manual/en/ref.mysql.php - XCVII. MySQL Improved Extensionhttp://www.php.net/manual/en/ref.mysqli.php - CXXIII. PostgreSQL Functionshttp://www.php.net/manual/en/ref.pgsql.php - CXXVI. Program Execution Functionshttp://www.php.net/manual/en/ref.exec.php - CXLVIII. SOAP Functionshttp://www.php.net/manual/en/ref.soap.php - CL. Standard PHP Library (SPL) Functionshttp://www.php.net/manual/en/ref.spl.php - CLI. SQLite Functionshttp://www.php.net/manual/en/ref.sqlite.php - CLVI. String Functionshttp://www.php.net/manual/en/ref.strings.php - Graphical library - For this we don't have Idea, probably we get an exists in PDA world, or if necessary we will make it. For make binary and libraries we will uses the Palm_OS_Developer_Suite_1_2, this is a suite developer based in Eclipse. We accept any help. We will notice when we register the project. Thanks -- Fernando Chure PSL/CE - Brasil
Re: [PHP] PEAR mail sorted as spam
Don't toppost. Preserve (just) enough context to make the mail comprehensible by someone who doesn't know the previous emails. Thanks. # [EMAIL PROTECTED] / 2007-01-03 11:14:27 +0100: When I send mail via PEARs Mail class they are sorted as spam by Thunderbird. Do you have any ideas why? I can't figure it out. # [EMAIL PROTECTED] / 2007-01-03 11:29:42 +0100: Roman Neuhauser wrote: Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. That's not what I asked. Does Thunderbird tell you why it marked something as spam? If it does, use that information. If it does not, you're crazy for using it. Either way, your question belongs into a Thunderbird mailing list, along with the exact full message. Full means including all headers, exact means you need to abandon formulations it was something like. Maybe I haven't included some header non-spam usually have or something? How are we supposed to know? Should we read Thunderbird's source code for you? :) -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Could you send us header of your mail please, just to see the prob Perhaps problem in sender : [EMAIL PROTECTED] Or domain who send the mail : localhost.localdomain I don't really know how thunderbird find some spam, that's why I prefer use kmail + bsfilter :) so ... give us more information We will help you perhaps :) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) - WinPT 1.0.1 iD8DBQFFm5V7Eg3iyspSWPARAiixAJ96MuBkpZAlpgj1tMgE97NDURLMpQCfXq8W rG2NqdH/F6nv97dv7IEZ8Ik= =7gkI -END PGP SIGNATURE-
Re: [PHP] Help me about detect client screen resolution!!!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Just remember in web context is a server-side language ... so you couldn't have more information than client would want to send to you in web context, the navigator send some information to the server (like what navigator, address, proxy, ...) so ... has David show you, use javascript for example, and can your php which screen resolution : index.html: script type=text/javascript location.href=index.php?h=+screen.heigth+w= +screen.width; /script = it will redirect to your php script which $_GET['h'] = heigth client resolution, and $_GET['w'] = width client resolution have fun -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) - WinPT 1.0.1 iD8DBQFFm5XdEg3iyspSWPARAiwbAJ9bFE+m/oFAcka236Xnccjzb6YY/ACdFc8G FuH5WvpqWEEkhMK0cYHhvOc= =syLI -END PGP SIGNATURE-
Re: [PHP] php 5 and register_globals=off gives lotsa errors
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You said if(action==main) So ... it's really that or you would said if($action==main) ??? the $ is important so ... perhaps phpv4 ignore this kind of mistake and not php5 or perhaps action is when register global is on ... so if miss $ before var, add it, and try again if not work .. send a piece of code $action = $_GET[action]; if ($action == main) { /*** do think ... ***/ }... Have fun -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) - WinPT 1.0.1 iD8DBQFFm5YqEg3iyspSWPARAmVnAJ9cATO6+9XCdz+WeH3Hgu3BeG3YjwCfdPFw eNY6PAnmZIfjV7wGN//pMIs= =opLP -END PGP SIGNATURE-
Re: [PHP] PEAR mail sorted as spam
Roman Neuhauser wrote: That's not what I asked. Does Thunderbird tell you why it marked something as spam? If it does, use that information. If it does not, you're crazy for using it. Either way, your question belongs into a Thunderbird mailing list, along with the exact full message. Full means including all headers, exact means you need to abandon formulations it was something like. As far as I can see it does not give more information. Why would that make me crazy? I can see what's marked as spam, and it gets better at finding spam the more emails I mark as spam or not spam. I think that is an okey solution. I don't want to spend more time on spam in my email client, since almost all spams are stopped by the mail server anyway. But I'll look for a log file. Maybe there are something hidden below the gui. Maybe I haven't included some header non-spam usually have or something? How are we supposed to know? Should we read Thunderbird's source code for you? :) Of course not. I just wondered if there was something obvious in the mail headers or whatever from pear that would make my mail look like spam. And I want a more mainstream solution that works on all/most email clients, not just firefox. But I'll talk to the mozilla folks instead, if you think it's so off topic to discuss this. Thanks for your time... Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Request of php5
Richard Lynch wrote: On Mon, January 1, 2007 12:40 am, [EMAIL PROTECTED] wrote: Dear All, Happy New Year, How much mem ( Ram ) does the php5 need ? Yes. :-) Depends on what extension you add, what you do with those extensions, and what sort of performance you expect to get. Depends if you run as a Module, as CGI, as Fast CGI, and if you are on Windows, Linux, FreeBSD, or Other. Probably a little more than PHP5, and not quite as much as PHP6. Does that help at all? I'd like to give a better answer, if you asked a better question. :-) I need php5 running with IMP ( Webmail - http://www.horde.org/imp ) and may be phpBB...
Re: [PHP] PEAR mail sorted as spam
# [EMAIL PROTECTED] / 2007-01-03 13:16:17 +0100: Roman Neuhauser wrote: That's not what I asked. Does Thunderbird tell you why it marked something as spam? If it does, use that information. If it does not, you're crazy for using it. Either way, your question belongs into a Thunderbird mailing list, along with the exact full message. Full means including all headers, exact means you need to abandon formulations it was something like. As far as I can see it does not give more information. Why would that make me crazy? Because it leads into trouble, like the one you're in now. Who knows, perhaps Thunderbird decided for you that short emails in languages other than English are spam. Perhaps you've labeled too many of such massages. I can see what's marked as spam, and it gets better at finding spam the more emails I mark as spam or not spam. I think that is an okey solution. Ok, but then you should be ready to live with its mysterious behaviors. Maybe I haven't included some header non-spam usually have or something? How are we supposed to know? Should we read Thunderbird's source code for you? :) Of course not. I just wondered if there was something obvious in the mail headers or whatever from pear that would make my mail look like spam. But you didn't include that message in your email to the list. And I want a more mainstream solution that works on all/most email clients, not just firefox. I used PEAR Mail to send emails from linux boxes that more often than not didn't even have the hostname set correctly, and I had no problems. Then again, AFAIK all recipients used either mutt or outlook. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
On 1/3/07, Emil Edeholt [EMAIL PROTECTED] wrote: Roman Neuhauser wrote: But I'll look for a log file. Maybe there are something hidden below the gui. Maybe I haven't included some header non-spam usually have or something? How are we supposed to know? Should we read Thunderbird's source code for you? :) Of course not. I just wondered if there was something obvious in the mail headers or whatever from pear that would make my mail look like spam. And I want a more mainstream solution that works on all/most email clients, not just firefox. But I'll talk to the mozilla folks instead, if you think it's so off topic to discuss this. The obvious problem with your question is well, no 'headers' were supplied. Then of course there are algorithms like bayesian that predict spam based on headers and content, with a learning curve. Then there is of course people on @aol.com addresses where depending on how things are setup, you will automatically go into the spam box if you are not in their address book. All in all mail sucks never rely on it to work. Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
On 1/3/07, Roman Neuhauser [EMAIL PROTECTED] wrote: . Then again, AFAIK all recipients used either mutt or outlook. Now that is a very disperse audience, i never see mutt mentioned often. Curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Request of php5
On 1/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Mon, January 1, 2007 12:40 am, [EMAIL PROTECTED] wrote: How much mem ( Ram ) does the php5 need ? ... Depends on what extension you add, what you do with those extensions, and what sort of performance you expect to get. Depends if you run as a Module, as CGI, as Fast CGI, and if you are on Windows, Linux, FreeBSD, or Other. ... I need php5 running with IMP ( Webmail - http://www.horde.org/imp ) and may be phpBB... How much ram is required is rather futile, it is more on how many requests per second your server can handle before you start even think about ram. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-02 21:23:02 +0100: David CHANIAL wrote: We are preparing the upgrade of PHP for our customers, but, after some tests, we have a migration problem caused by the news E_RECOVERABLE_ERROR. So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about the method to handle this new errors (by using try/catch), they don't talk there is no mention of try/catch - it seems that the rather unfortunate word 'catchable' was used to describe the act of setting up a user defined error handler (see: http://php.net/manual/en/function.set-error-handler.php) to handle errors that are triggered by the php core. [errors != exceptions] Roman - you make some very good point but the pragmatist in me says of your first example - why the F*** would anyone pass in an object and blindly push it through printf() ?? that sucks as far as code goes (personally evening being so diligent as to implement __toString() on the relevant class is asking for bad news - too much magic imho) if the function should be capable of taking an object or a string it should check what it recieves. the way I see it this is bad code by design - and needs to be fixed. Unfortunately. Consider this: function f($any) { printf(%s\n, $any); } Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object without __toString(). The 5.2.0 changelog talks about problems with the textual representation (object #id), but this cure is IMO worse than the disease, especially as they didn't make it an exception which would be *much* easier to handle: true - but then it would force someone to use exceptions - the overall consensus went against forcing that on people. function f($any) { try { printf(%s\n, $any); } catch (CastError $e) { printf(%s\n, spl_object_hash($any)); } } In fact, I wonder why spl_object_hash() hasn't replaced the old default behavior. that is a good point - from what I've read that will probably be implemented very soon (pity it missing now though) One way to (almost) handle this (or indeed warnings in PHP at all) is to use an error_handler that mutates all it can into exceptions. Unfortunately, you can only do this if there's no independently developed code in the program. If it uses a library that's not written for a throwing error handler, such a handler will change the library's semantics! Imagine a DB library that contained this code: if (false === ($conn = mysql_connect())) { handle_error(); } handle_error() will never be called with a throwing error handler. And you cannot use such a handler in the library either, because the application would have to defend against the library error handler leaking e. g. into signal handlers. Also, if every library had to install/deinstall its own error handler on every entry and exit of its code... I don't want to even think of that. To me, E_RECOVERABLE_ERROR, or at least some of its instances, seem to be more of an interoperability problem than anything else. But that's IMO true of the whole error handling in PHP. :-) Now back to our regularly scheduled pushing files around t3h 1nt3rn3t. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
# [EMAIL PROTECTED] / 2007-01-03 04:42:05 -0800: On 1/3/07, Roman Neuhauser [EMAIL PROTECTED] wrote: . Then again, AFAIK all recipients used either mutt or outlook. Now that is a very disperse audience, The reports went to two types of people: admins and managers. i never see mutt mentioned often. Try subscribing to [EMAIL PROTECTED] :) -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array decleration problem
Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) $flavors2 [0] =3; $flavors2 [1]=13; $fruits [red] = system; $fruits [yellow] = server; $fruits [purple] = client; echo $flavors; echo br /; echo $flavors2; echo br /; echo $fruits; ? I get an error message: Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16 I embedded the code into an html document so line 16 is line 6 ($flavors2[0]=3;) I have no idea why is this error showing up i tried everything Thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array decleration problem
it happens because you forgot the semi-collon at the end of the previews line. Delta Storm [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL PROTECTED] Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) $flavors2 [0] =3; $flavors2 [1]=13; $fruits [red] = system; $fruits [yellow] = server; $fruits [purple] = client; echo $flavors; echo br /; echo $flavors2; echo br /; echo $fruits; ? I get an error message: Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16 I embedded the code into an html document so line 16 is line 6 ($flavors2[0]=3;) I have no idea why is this error showing up i tried everything Thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-02 21:23:02 +0100: David CHANIAL wrote: We are preparing the upgrade of PHP for our customers, but, after some tests, we have a migration problem caused by the news E_RECOVERABLE_ERROR. So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about the method to handle this new errors (by using try/catch), they don't talk there is no mention of try/catch - it seems that the rather unfortunate word 'catchable' was used to describe the act of setting up a user defined error handler (see: http://php.net/manual/en/function.set-error-handler.php) to handle errors that are triggered by the php core. [errors != exceptions] Roman - you make some very good point but the pragmatist in me says of your first example - why the F*** would anyone pass in an object and blindly push it through printf() ?? that sucks as far as code goes (personally evening being so diligent as to implement __toString() on the relevant class is asking for bad news - too much magic imho) if the function should be capable of taking an object or a string it should check what it recieves. the way I see it this is bad code by design - and needs to be fixed. Well, why the F*** would anyone use a language that allows you to pass incompatible objects to a function and crashes when you do so? ;) Errors and warnings are fine for languages where the compilation step is separate from the run. For a language like PHP, anything but RuntimeException means your perfectly correct code can crash at runtime, without you having a slightest chance to react (in the code). Unfortunately. Consider this: function f($any) { printf(%s\n, $any); } Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object without __toString(). The 5.2.0 changelog talks about problems with the textual representation (object #id), but this cure is IMO worse than the disease, especially as they didn't make it an exception which would be *much* easier to handle: true - but then it would force someone to use exceptions - the overall consensus went against forcing that on people. I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array decleration problem
# [EMAIL PROTECTED] / 2007-01-02 10:48:27 +0100: Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) that statement is incomplete (; missing). I get an error message: Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16 -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can i hightlight an stacktrace error/exception?
Hello there, Is there a way to color exceptions/errors? I try d to use highlight_string() but that only works on PHP code. Does someone has a function or something which can do this? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array decleration problem
There another error in your code in addition to the missing ;, echo() is for strings, not arrays. Also, look up the use of single and double quotes in the php docs. It's a good habit to learn to use the right one early on. Delta Storm wrote: Hi, I'm new to php and im learning, I haven't encounter any problems till now so please help me? :) the code: (learning arrays...) ?php $flavors=array (banana, cucumber, grape, vanilla) $flavors2 [0] =3; $flavors2 [1]=13; $fruits [red] = system; $fruits [yellow] = server; $fruits [purple] = client; echo $flavors; echo br /; echo $flavors2; echo br /; echo $fruits; ? I get an error message: Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16 I embedded the code into an html document so line 16 is line 6 ($flavors2[0]=3;) I have no idea why is this error showing up i tried everything Thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can i hightlight an stacktrace error/exception?
Mathijs wrote: Hello there, Is there a way to color exceptions/errors? I recommend a combination of php html (maybe with some css and javascript thrown in for good measure) e.g. (ripped straight from zend.com): ?php function printException(Exception $e) { print h1.get_class($e)./h1\n; print h2{$e-getMessage()} ({$e-getCode()})/h2\n\n; print file: {$e-getFile()}br /\n; print line: {$e-getLine()}br /\n; print $e-getTraceAsString(); } ? STFW if you want something more sophisticated. I try d to use highlight_string() but that only works on PHP code. Does someone has a function or something which can do this? Thx in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read cookies set by php?
On 03/01/07, Peter Lauri [EMAIL PROTECTED] wrote: Are you trying to read cookies that are not set by your host? If that is the case you will probably be disappointed. The purpose with cookies is that they should only be table to be read by the one who is setting the cookie. If you want to read cookies on the machine that you are able to view just: echo pre; print_r($_COOKIE); echo /pre; Best regards, Peter Lauri Thanks, Paul. I should have asked the question in a firefox community, not a php community. I want to see the cookies stored on my machine. The reason that I want to do that is to debug a php script, but it certainly is not a php issue. Sorry for the noise. Dotan Cohen http://what-is-what.com/what_is/webpage.html http://olnu.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read cookies set by php?
On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Configure the browser to prompt you before saving cookies, and then surf there again? FIrst thing that I did (well, second). The cookies are obfuscated. Turn on LiveHTTPHeaders and see what the browser sends when you surf back to that site? I'll do that. I tried with the web developer's extension. I'm actually surprised that it didn't work for me. Hack your /etc/hosts or \WINDOWS\system32\drivers\etc\hosts to have the other guy's domain re-directed to your localhost, and set up PHP to var_dump($_COOKIES) might work? Seems like an awful lot of work, but it might make you feel like a real hacker :-) :-) :-) Nice. Might just do it for the experience. I've played with /etc/hosts to get rid of advertisements, so I'm comfortable with it. Thanks. Dotan Cohen http://what-is-what.com/what_is/linux_distribution.html http://lyricslist.com/lyrics/lyrics/136/457/spears_britney/britney.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-02 21:23:02 +0100: David CHANIAL wrote: We are preparing the upgrade of PHP for our customers, but, after some tests, we have a migration problem caused by the news E_RECOVERABLE_ERROR. So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about the method to handle this new errors (by using try/catch), they don't talk there is no mention of try/catch - it seems that the rather unfortunate word 'catchable' was used to describe the act of setting up a user defined error handler (see: http://php.net/manual/en/function.set-error-handler.php) to handle errors that are triggered by the php core. [errors != exceptions] Roman - you make some very good point but the pragmatist in me says of your first example - why the F*** would anyone pass in an object and blindly push it through printf() ?? that sucks as far as code goes (personally evening being so diligent as to implement __toString() on the relevant class is asking for bad news - too much magic imho) if the function should be capable of taking an object or a string it should check what it recieves. the way I see it this is bad code by design - and needs to be fixed. Well, why the F*** would anyone use a language that allows you to pass incompatible objects to a function and crashes when you do so? ;) Errors and warnings are fine for languages where the compilation step is separate from the run. For a language like PHP, anything but RuntimeException means your perfectly correct code can crash at runtime, without you having a slightest chance to react (in the code). you have to pay some kind of price for dynamic typing and intepreted running. testing is done for a reason and I stand by my opinion that your given example is tantamount to awful coding and it should be corrected. granted when confronted with code that is already in the wild and your suddenly faced with such an error on a live system (due to an update) it's very very annoying (at the least) - such is life (or is that just coding?) :-) Unfortunately. Consider this: function f($any) { printf(%s\n, $any); } Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object without __toString(). The 5.2.0 changelog talks about problems with the textual representation (object #id), but this cure is IMO worse than the disease, especially as they didn't make it an exception which would be *much* easier to handle: true - but then it would force someone to use exceptions - the overall consensus went against forcing that on people. I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? probably not - i wouldn't know I don't live in that camp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-03 16:43:14 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100: Roman - you make some very good point but the pragmatist in me says of your first example - why the F*** would anyone pass in an object and blindly push it through printf() ?? that sucks as far as code goes (personally evening being so diligent as to implement __toString() on the relevant class is asking for bad news - too much magic imho) if the function should be capable of taking an object or a string it should check what it recieves. the way I see it this is bad code by design - and needs to be fixed. Well, why the F*** would anyone use a language that allows you to pass incompatible objects to a function and crashes when you do so? ;) Errors and warnings are fine for languages where the compilation step is separate from the run. For a language like PHP, anything but RuntimeException means your perfectly correct code can crash at runtime, without you having a slightest chance to react (in the code). you have to pay some kind of price for dynamic typing and intepreted running. testing is done for a reason and I stand by my opinion that your given example is tantamount to awful coding and it should be corrected. Why is it awful coding? I have a piece of code where exactly this is (was in 5.1) a perfectly reasonable thing to do (the example is contrived to clearly demonstrate the behavior at hand). The output was for informational purposes, and the Object #N presentation was completely adequate even with its quirks. BTW, would you share a version of f($any) that meets your definition of good code? function f($any) { printf(%s\n, $any); } true - but then it would force someone to use exceptions - the overall consensus went against forcing that on people. I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? probably not - i wouldn't know I don't live in that camp. That's why I didn't ask *you*. ;) -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Request of php5
Curt Zirzow wrote: On 1/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Mon, January 1, 2007 12:40 am, [EMAIL PROTECTED] wrote: How much mem ( Ram ) does the php5 need ? ... Depends on what extension you add, what you do with those extensions, and what sort of performance you expect to get. Depends if you run as a Module, as CGI, as Fast CGI, and if you are on Windows, Linux, FreeBSD, or Other. ... I need php5 running with IMP ( Webmail - http://www.horde.org/imp ) and may be phpBB... How much ram is required is rather futile, it is more on how many requests per second your server can handle before you start even think about ram. Curt But actually, I want to know how muach mem ( ram ) does the new version of php need ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-03 16:43:14 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100: Roman - you make some very good point but the pragmatist in me says of your first example - why the F*** would anyone pass in an object and blindly push it through printf() ?? that sucks as far as code goes (personally evening being so diligent as to implement __toString() on the relevant class is asking for bad news - too much magic imho) if the function should be capable of taking an object or a string it should check what it recieves. the way I see it this is bad code by design - and needs to be fixed. Well, why the F*** would anyone use a language that allows you to pass incompatible objects to a function and crashes when you do so? ;) Errors and warnings are fine for languages where the compilation step is separate from the run. For a language like PHP, anything but RuntimeException means your perfectly correct code can crash at runtime, without you having a slightest chance to react (in the code). you have to pay some kind of price for dynamic typing and intepreted running. You don't, look at Python. Instead of warnings and fatal errors, good for logging purposes at best, you get to choose how to handle the problem. What kind of dynamic typing are we talking about if f($any) { printf(%s, $any); } is bad code? If you dare to use dynamic features in PHP you're begging to have your throat cut by some call to undefined method, or hop in to lala land with an undefined member variable access warning... If problems with the dynamic typing of PHP end in somewhat undynamic fatal errors, your only choice is to have all paths in the program statically verified, IOW, steer completely clear of the dynamic features. That'll be a terribly tedious job. You can do this in Python (completely safe and meaningful): def f(any): print %s % any You can even call any method on any object safely: def g(o): o.f() If o doesn't have a callable member called f, you'll get an exception you can catch: def g(o): try: o.f() except AttributeError: print stderr, oops! The lack of global error handlers allows mixing of independently developed software, that's quite dynamic. If you believe that something like f($any) { if (is_string($any)) { printf(%s, $any); } else if (...) { ... } } is better than the single sprintf() version, we'll just have to agree to disagree. Where's the dynamism again? You could write this in C++: void f(any a) { cout a; } with less typing more dynamism than you get with PHP. And the resulting binary won't crash at runtime. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pushing a file to the browser
hi mike... i'mnot sure what you mean to do, but i think you want to take a file as input, do some modifications to it, and then display the file on your site... or do you want to allow the user to download the modified file, or do you want to be able to automatically send the 'massaged file' to the user? is this the case? -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 5:39 PM To: php-general@lists.php.net Subject: [PHP] Pushing a file to the browser Hello, I have a script I've created which takes a file upload, monkeys with the data in it, and needs to push the new file out to the browser. Everything is coded and working up to that last point, but I've never pushed out a file to the browser before. Does anyone have the code for this laying around that I can see (and modify)? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
On Wed, 2007-01-03 at 17:49 +, Roman Neuhauser wrote: If you dare to use dynamic features in PHP you're begging to have your throat cut by some call to undefined method, or hop in to lala land with an undefined member variable access warning... If problems with the dynamic typing of PHP end in somewhat undynamic fatal errors, your only choice is to have all paths in the program statically verified, IOW, steer completely clear of the dynamic features. That'll be a terribly tedious job. You can do this in Python (completely safe and meaningful): def f(any): print %s % any You can even call any method on any object safely: def g(o): o.f() If o doesn't have a callable member called f, you'll get an exception you can catch: def g(o): try: o.f() except AttributeError: print stderr, oops! The lack of global error handlers allows mixing of independently developed software, that's quite dynamic. Not to get into this argument but the PHP equivalent is: ?php if( method_exists( $o, 'f' ) ) { $o.f(); } else { fprintf( stderr, 'oops!' ); } ? 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] Request of php5
# [EMAIL PROTECTED] / 2007-01-04 00:09:37 +0800: Curt Zirzow wrote: On 1/3/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Mon, January 1, 2007 12:40 am, [EMAIL PROTECTED] wrote: How much mem ( Ram ) does the php5 need ? ... Depends on what extension you add, what you do with those extensions, and what sort of performance you expect to get. Depends if you run as a Module, as CGI, as Fast CGI, and if you are on Windows, Linux, FreeBSD, or Other. ... I need php5 running with IMP ( Webmail - http://www.horde.org/imp ) and may be phpBB... How much ram is required is rather futile, it is more on how many requests per second your server can handle before you start even think about ram. But actually, I want to know how muach mem ( ram ) does the new version of php need ? Excuse me, are you pulling our legs or do you have reading problems? Several people have already told you that the memory footprint depends on several factors, of which you specified NONE. To satisfy your thirst for meaningless numbers, here's the CLI php 5.2.0 waiting for input on FreeBSD-6.1/amd64, with *unspecified number* of *various* extensions: USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND roman 26242 0.0 1.0 58348 10608 pg I+5:52PM 0:00.06 php As you can see, PHP 5 takes 10MB. Did I mention that number is useless for you? I just don't understand why you don't try it yourself. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-03 11:57:03 -0500: Not to get into this argument [...] Nah, just chattin'. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Removing UTF-8 from text
I have many email address that are stored like this: =?UTF-8?B?15jXqNeR15XXp9eZ16DXlCDXnteo15nXkNeg15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15nXoNem158g157XqNeZ15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15zXmSDXpNeV15zXmdeg15Q=?= [EMAIL PROTECTED] I'm trying to run a script that will leave the file as so: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] The first step is to remove the UTF-8 names. This code _doesn't_ work, but I think that it should: $text=preg_replace('/\=\?UTF\-8\?B\?([a-z0-9]+)\?=\/i', '', $text); I've tried with single and double quotes, and I've tried backslashing and not backslashing the question marks. Where am I erring? Thanks. Dotan Cohen http://technology-sleuth.com/long_answer/what_are_the_advantages_of_lcd_monitors.html http://kubuntu.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
On Wed, 2007-01-03 at 11:57 -0500, Robert Cummings wrote: On Wed, 2007-01-03 at 17:49 +, Roman Neuhauser wrote: ?php if( method_exists( $o, 'f' ) ) { $o.f(); That should have been $o-f() btw. Too much JavaScript lately :D 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] Pushing a file to the browser
Hi, I assume that you mean you want to send the file as application/octet-stream. Take a look at this: ob_start(); $path = 'path to directory where file resides'; $filename = 'the name of the file'; ob_end_clean(); header(Pragma: public); header(Expires: 0); // set expiration time header(Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=$filename); header(Content-Transfer-Encoding: binary); $filesize = filesize($path.$filelocation); header(Content-Length: $filesize); echo file_get_contents($path.$filelocation); You could also use fread() or similar if the file is larger. Let me know if it helped. Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Mike Mannakee [mailto:[EMAIL PROTECTED] Sent: Saturday, September 16, 2006 2:39 AM To: php-general@lists.php.net Subject: [PHP] Pushing a file to the browser Hello, I have a script I've created which takes a file upload, monkeys with the data in it, and needs to push the new file out to the browser. Everything is coded and working up to that last point, but I've never pushed out a file to the browser before. Does anyone have the code for this laying around that I can see (and modify)? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
# [EMAIL PROTECTED] / 2007-01-03 19:51:56 +0200: I have many email address that are stored like this: =?UTF-8?B?15jXqNeR15XXp9eZ16DXlCDXnteo15nXkNeg15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15nXoNem158g157XqNeZ15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15zXmSDXpNeV15zXmdeg15Q=?= [EMAIL PROTECTED] I'm trying to run a script that will leave the file as so: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] The first step is to remove the UTF-8 names. This code _doesn't_ work, but I think that it should: $text=preg_replace('/\=\?UTF\-8\?B\?([a-z0-9]+)\?=\/i', '', $text); I've tried with single and double quotes, and I've tried backslashing and not backslashing the question marks. Where am I erring? Thanks. You should not try backslashing and not backslashing. Read the documentation instaed, it's clear. In the meantime, this will work: sed 's/^.*\([^]\+\),$/\1/' file -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removing UTF-8 from text
Why not simply capture what you want, rather than try to remove what you don't want? preg_match_all(%([EMAIL PROTECTED])%, $text, $matches); now print_r($matches[1]) and you see your addresses A little better code might be, sense it is more explicit and less prone to pick up malformed addresses. preg_match_all(%([EMAIL PROTECTED],4})%, $text, $matches); Make a new file with: $new_file= ''; foreach($matches[1] as $addr){ $new_file .= $addr . br; } Al. Dotan Cohen wrote: I have many email address that are stored like this: =?UTF-8?B?15jXqNeR15XXp9eZ16DXlCDXnteo15nXkNeg15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15nXoNem158g157XqNeZ15Q=?= [EMAIL PROTECTED], =?UTF-8?B?15zXmSDXpNeV15zXmdeg15Q=?= [EMAIL PROTECTED] I'm trying to run a script that will leave the file as so: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] The first step is to remove the UTF-8 names. This code _doesn't_ work, but I think that it should: $text=preg_replace('/\=\?UTF\-8\?B\?([a-z0-9]+)\?=\/i', '', $text); I've tried with single and double quotes, and I've tried backslashing and not backslashing the question marks. Where am I erring? Thanks. Dotan Cohen http://technology-sleuth.com/long_answer/what_are_the_advantages_of_lcd_monitors.html http://kubuntu.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Removing UTF-8 from text
On 03/01/07, Al [EMAIL PROTECTED] wrote: Why not simply capture what you want, rather than try to remove what you don't want? Because there are also emails in there in this format: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] preg_match_all(%([EMAIL PROTECTED])%, $text, $matches); now print_r($matches[1]) and you see your addresses Hey, that's pretty good! Thanks. I'm going to go reread and remind myself why you used % instead of slashes. I should know that, but I don't. Thanks. Dotan Cohen http://dotancohen.com/howto/firefox_password_manager.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
On Wed, January 3, 2007 4:29 am, Emil Edeholt wrote: I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. Maybe I haven't included some header non-spam usually have or something? Did my script look all okey? There's no magical this is not spam header. If there was, all the spammers would include it, and what would be the point? What you have to do is compare your email with one that survives the spam obstacle course, and make your email lean and mean and fit to survive. Without looking at your code/email, the FIRST thing to do is to get rid of HTML-enhanced (cough, cough) email. Just use plain-text. The odds of HTML-enhanced (cough, cough) email being spam is *SO* much higher than plain-text, that you are right away going to lose the battle with many spam filters if you use HTML-enhanced email. Next, make sure that it looks like a REAL PERSON sent the email. The From: and Reply-to: lines should be: Emil Edeholt [EMAIL PROTECTED] and not just: [EMAIL PROTECTED] There are a zillion other things you can do -- You may want to install SpamAssassin (etc) and run your email through it. It adds headers that tell you EXACTLY why you are losing points in the obstacle course and getting labeled as spam. Some things will be beyond your control, or willingness to change. Having medical.se as the return address will probably send up a red flag, just because of the disproportionate number of medical related spams. Fortunately, you don't need a PERFECT non-spam score -- Just one good enough to pass the course. The final number is user-configurable, so it's about coming closer to an ideal rather than achieving a perfect score. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read cwk files
On Wed, January 3, 2007 2:18 am, John Salib wrote: I need to read cwk files (mac clarisworks files). so is it possible to do so using php if so how to do that? Google for cwk2xls and see if you can convert Clarisworks to MS Excel, which *has* to be a very common need. You can then use the XLS reader you already found and call it done. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http request problem
On Tue, January 2, 2007 11:55 pm, Kencana wrote: I got problem in getting file content. the file is located at another server (tomcat) and it is a jsp file. i don't know why i keep getting the same error message file accessing that file but while i am trying to access to another file, from another server it run perfect. this is the error message i get: PHP Warning: file_get_contents(http://123.123.1.2:8008/V3JRoute?slot=1startX=103.880764startY=1.335458endX=103.886297endY=1.334953routeType=1format=2) [function.file-get-contents]: failed to open stream: HTTP request failed! $5$13:53:22,13:53:22,13:53:22,13:53:22,13:53:22$0.0,0.0,0.0,0.0,0.0$Depart on,Turn sharp left onto,Continue on,Turn right onto in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\phpviewersample\xmlaccesstrial.php on line 5 take note that the text in bold is part of the page contents. i don't understand why i cant get the whole content and keep getting this error. I hope somebody can help me out. First, it is entirely possible that the service provided is filtering on request IP and only responds nicely to requests from specific IP servers. This is *very* common in paid-for peer-to-peer business-to-business services. If you have an account with the folks providing this service, just let them know your static IP, and they'll add it to their friend list on their end. If that's not what's going on, I suggest you try using CURL to see if you can get the headers to find out more info about WHY the request is being denied. Or you can use wget --server-response if you don't have curl. Or perhaps Firefox and LiveHTTPHeaders. Or even PHP's fopen/fread. Just use *something* to see the full raw response. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need help with PHP, cURL, and POST
On Tue, January 2, 2007 8:56 pm, Charley wrote: What do you mean about the submit input? I thought that was just a text link to cause the form to be submitted when clicked. I didn't know that it sent anything to the server. (As you can tell, I don't know anything about asp except what it stands for.) input type=submit / This line in HTML, with variations, *WILL* send another submit=Submit as part of the HTTP request. If you don't send that part, ASP scripts will puke on your pretty blue suede shoes, more often than not, in my experience. Never mind that Netscape 2 didn't send this field when you hit Enter instead of actually clicking the button for a one-button form (default action: submit). MS never cared about interoperability then, and they don't now, and I don't expect them to ever care in the future, no matter how many times they claim to embrace and extend (or whatever their slogan is this week). The paymentidfilter is a legitimate field, and works in the form and in the GET version of the cURL stuff. Okay -- It just wasn't in the FORM, so wanted to check. It seems that e-gold has as its error response to send the login page for whatever one is asking for. This is not very helpful (at least to me). Oh, but it's *VERY* helpful. It tells you that you are not proving to the server that you are a legitimate logged-in user. Which, in turn, means that somehow you need to do just that -- Fool their server into accepting and maintaining your login credentials. What this usually entails is something like this: $curl = curl_init(); //login: curl_setopt(CURLOPT_URL, .../login.asp); curl_setopt(CURLOPT_POSTDATA, username=foopassword=bar); curl_setopt(CURLOPT_COOKIEJAR, /full/path/to/php/writable/cookie/storage/file.txt); curl_setopt(CURLOPT_COOKIEFILE, /full/path/to/php/writable/cookie/storage/file.txt); //get data we actually want //the script you currently have gets pasted in here I'll see if I can get this LiveHTTPheaders thing for firefox, since firefox is my main browser. From what I read, the cookie jar and file options take the name of the same file as their arguments. Is there any path information that is required? Can I just use something like mycookies.txt or must it have a specific extension? The only restriction is that it MUST be readable/writable by the User php runs as, so that PHP can write down the cookies it gets, and spit them back to prove that it is still a valid user. You also cannot use the COOKIE(JAR|FILE) with the CURLOPT_HEADER option that lets you see the other headers. :-( If you need the other headers, you have to manage the cookies on your own instead of letting curl do it for you. This is not all that tricky, really, once you look at what a Cookie actually looks like in the headers. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
On Wed, January 3, 2007 8:24 am, Roman Neuhauser wrote: I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? Sure. function f($any) { printf(%s\n, $any); } function print_any($any){ switch(gettype($any)){ case boolean: // (since PHP 4) echo $any ? true\n : false\n; break; case integer: case double: //aka float case string: echo $any\n; break; case array: var_dump($any); echo \n; break; case object: //you could check for the method __toString() if you like. var_dump($any); echo \n; break; case resource: //(since PHP 4) echo Internal PHP Resource: $any\n; break; case NULL: //(since PHP 4) echo NULL\n: break; case user function: // (PHP 3 only, deprecated) echo UPGRADE! Function: $any\n; break; case unknown type: default: echo unknown data type\n; error_log(__FILE__ . : . __LINE__ . unknown data type. Check gettype documentation); break; } } The problem with try/catch is that, as already noted in this thread, as soon as you reach a certain level of complexity and a large enough code-base, the whole house of cards comes tumbling down because one developer somewhere isn't using the same semantics for errors as you are. This can be as obvious as not using try/catch at all, to something very subtle such as what to *DO* with the errors or what kinds of errors to catch. So, actually, it's not about try/catch being Java, as try/catch did not originate with Java, as it is about try/catch just not being scalable to wide-spread development. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
On Wed, January 3, 2007 11:51 am, Dotan Cohen wrote: I have many email address that are stored like this: =?UTF-8?B?15jXqNeR15XXp9eZ16DXlCDXnteo15nXkNeg15Q=?= [EMAIL PROTECTED], ×× ×¦× ×ר×× [EMAIL PROTECTED], ×× ×¤×××× × [EMAIL PROTECTED] I'm trying to run a script that will leave the file as so: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] The first step is to remove the UTF-8 names. This code _doesn't_ work, but I think that it should: $text=preg_replace('/\=\?UTF\-8\?B\?([a-z0-9]+)\?=\/i', '', $text); I've tried with single and double quotes, and I've tried backslashing and not backslashing the question marks. Where am I erring? Thanks. Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read cookies set by php?
On Wed, January 3, 2007 9:02 am, Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Configure the browser to prompt you before saving cookies, and then surf there again? FIrst thing that I did (well, second). The cookies are obfuscated. They won't get any clearer than that... What you see is what you get, which is what you'll see with all these methods. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? Dotan Cohen http://lyricslist.com/lyrics/artist_albums/336/mclachlan_sarah.html http://what-is-what.com/what_is/world_wide_web.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
# [EMAIL PROTECTED] / 2007-01-03 14:01:29 -0600: On Wed, January 3, 2007 8:24 am, Roman Neuhauser wrote: I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? Sure. function f($any) { printf(%s\n, $any); } function print_any($any){ [34 lines of a switch ellided] } Nice. Now I see how the dynamic nature of PHP boosts development. :) The problem with try/catch is that, as already noted in this thread, as soon as you reach a certain level of complexity and a large enough code-base, the whole house of cards comes tumbling down because one developer somewhere isn't using the same semantics for errors as you are. Erm, no. The note I made earlier in this thread said that changing semantics of unsuspecting programs by using a throwing error handler would be disastrous, and that was after I discussed using such a throwing handler *for better error handling*. This can be as obvious as not using try/catch at all, to something very subtle such as what to *DO* with the errors Same kinds of things you do with errors in a procedural program. or what kinds of errors to catch. Those that you know how to handle, of course. Or was that a different question? So, actually, it's not about try/catch being Java, as try/catch did not originate with Java, as it is about try/catch just not being scalable to wide-spread development. Can you qualify that statement? What things are impossible? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Port Block
I used to use mailenable to send e-mails from a site hosted on my computer, to email anyone. Now my ISP blocked port 25 so I can't connect directly to any smtp servers like google to send e-mail directly from my computer. Does anyone know of an open SMTP server which doesn't use port 25?
Re: [PHP] How to read cookies set by php?
On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, January 3, 2007 9:02 am, Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Configure the browser to prompt you before saving cookies, and then surf there again? FIrst thing that I did (well, second). The cookies are obfuscated. They won't get any clearer than that... What you see is what you get, which is what you'll see with all these methods. No, I think that if I spoof the server via /etc/hosts then I'll be able to pull content out of the cookie. In my spare time Dotan Cohen http://what-is-what.com/what_is/fedora_core.html http://dotancohen.com/howto/root_email.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
# [EMAIL PROTECTED] / 2007-01-03 22:41:54 +0200: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? It's for Did you know that the syntax is described in the manual? Did you know that PHP has a manual on the web? It's at http://www.php.net/;. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
You can use anything for delimiters | e.g., I like % m is for multiline, which I don't think you want here. s is for dotall; but, I don't see his dot. I try to avoid using dotall; it is too hard to think of everything it can include. Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? Dotan Cohen http://lyricslist.com/lyrics/artist_albums/336/mclachlan_sarah.html http://what-is-what.com/what_is/world_wide_web.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IE, Word documents and Content Types
Hi. I have a form where a user can upload different types of documents. A valid file type they will be able to upload is a Word Document. However, when I view the $_FILES 'type' of a word document in Internet Explorer, it says it's type 'application/octet-stream' instead of 'application/msword' or 'application/vnd.ms-word'. It works fine in Firefox and Safari. Any ideas why IE does this and/or how I might be able to get around this? I know of 1 or 2 options for sort of bypassing this, but I'd like to hear from the group to see if there's a better, security-conscious idea. Thanks in advance, ~Philip +--+ When you least expect it... expect it! +--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
Correction... If your text is truly multiline, as you've shown, then you do need the 'M' Al wrote: You can use anything for delimiters | e.g., I like % m is for multiline, which I don't think you want here. s is for dotall; but, I don't see his dot. I try to avoid using dotall; it is too hard to think of everything it can include. Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? Dotan Cohen http://lyricslist.com/lyrics/artist_albums/336/mclachlan_sarah.html http://what-is-what.com/what_is/world_wide_web.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-02 21:23:02 +0100: David CHANIAL wrote: We are preparing the upgrade of PHP for our customers, but, after some tests, we have a migration problem caused by the news E_RECOVERABLE_ERROR. So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about the method to handle this new errors (by using try/catch), they don't talk there is no mention of try/catch - it seems that the rather unfortunate word 'catchable' was used to describe the act of setting up a user defined error handler (see: http://php.net/manual/en/function.set-error-handler.php) to handle errors that are triggered by the php core. [errors != exceptions] Unfortunately. Consider this: function f($any) { printf(%s\n, $any); } Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object without __toString(). It's also an example of a former C coder's understanding of how to do things in PHP. Not only is this extremely inefficient (a function call is significant overhead in PHP) it is doubly inefficient through the unnecessary use of printf(). printf() is best used when you are modifying the display of the output, the %s modifier by itself is pointless in PHP. function f($any) { echo $any . \n; } This has no E_RECOVERABLE_ERROR possibility and is far more efficient. Better yet, replace f($blah) with echo $blah . \n This is a good example of how the flexibility of PHP can bite you, but is also a good example of how bad coding adds both complexity and inefficiency to the resulting software. If f() is called often, there might be a noticeable speedup if it were replaced. I once had a complex database ORM-HTML mapping app that was about 10% faster when I replaced all the strings with '' strings. This was on a slow machine with an early PHP, but little things like this can be very important. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Port Block
On Wed, January 3, 2007 2:44 pm, Christopher Deeley wrote: I used to use mailenable to send e-mails from a site hosted on my computer, to email anyone. Now my ISP blocked port 25 so I can't connect directly to any smtp servers like google to send e-mail directly from my computer. Does anyone know of an open SMTP server which doesn't use port 25? Perhaps you could talk to gmail or google and find out how they've solved this problem for their other million users... Or, rather, search their sites for the answer, since it almost for sure has to be there. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read cookies set by php?
On Wed, January 3, 2007 2:44 pm, Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, January 3, 2007 9:02 am, Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Configure the browser to prompt you before saving cookies, and then surf there again? FIrst thing that I did (well, second). The cookies are obfuscated. They won't get any clearer than that... What you see is what you get, which is what you'll see with all these methods. No, I think that if I spoof the server via /etc/hosts then I'll be able to pull content out of the cookie. In my spare time The values you see in the cookie that way are the same values you'll see in the headers is all I'm saying. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 16:43:14 +0100: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100: BTW, would you share a version of f($any) that meets your definition of good code? I would suggest adding some sanity checking - as opposed to relying on any kind of error trigger/trapping/catching mechanism. the regard to the point of the possible/perceived cons of working with an interpreted, dynamically typed language the post Gregory Beaver made make the case much more clearly than I could have. I'll leave this thread for what it is now, leave it to say that it's been a very interesting discussion and I certainly appreciated your [Roman] thoughtful examples arguments. rgds, Jochem function f($any) { printf(%s\n, $any); } true - but then it would force someone to use exceptions - the overall consensus went against forcing that on people. I don't follow the logic. What did we gain? Can one of those exceptions == Java, Java stinks, exceptions stink campers show me their version of the below f($any) that works in 5.1 and 5.2? probably not - i wouldn't know I don't live in that camp. That's why I didn't ask *you*. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE, Word documents and Content Types
On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote: I have a form where a user can upload different types of documents. A valid file type they will be able to upload is a Word Document. However, when I view the $_FILES 'type' of a word document in Internet Explorer, it says it's type 'application/octet-stream' instead of 'application/msword' or 'application/vnd.ms-word'. It works fine in Firefox and Safari. Any ideas why IE does this and/or how I might be able to get around this? IE does this because MS is not interested in interoperability. Note that application/octet-stream is valid for any kind of document whatsoever for an upload. For output, that would require the browser to download the document rather than attempt to display it. More on that here: http://richardlynch.blogspot.com/ I know of 1 or 2 options for sort of bypassing this, but I'd like to hear from the group to see if there's a better, security-conscious idea. The security-conscious idea is to IGNORE the 'type' in $_FILES, because anybody could cram anything they want in to that, and send you any kind of virus-laden warez document. :-) Use Mime Magic or exec(file /path/to/upload, $output, $error) to find out what kind of document they REALLY uploaded, regardless of what they CLAIM it is in $_FILE['type'] -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE, Word documents and Content Types
hi Richard, Best Wishes for the new year btw! Richard Lynch wrote: On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote: I have a form where a user can upload different types of documents. A valid file type they will be able to upload is a Word Document. However, when I view the $_FILES 'type' of a word document in Internet Explorer, it says it's type 'application/octet-stream' instead of 'application/msword' or 'application/vnd.ms-word'. It works fine in Firefox and Safari. Any ideas why IE does this and/or how I might be able to get around this? IE does this because MS is not interested in interoperability. Note that application/octet-stream is valid for any kind of document whatsoever for an upload. For output, that would require the browser to download the document rather than attempt to display it. More on that here: http://richardlynch.blogspot.com/ I know of 1 or 2 options for sort of bypassing this, but I'd like to hear from the group to see if there's a better, security-conscious idea. The security-conscious idea is to IGNORE the 'type' in $_FILES, because anybody could cram anything they want in to that, and send you any kind of virus-laden warez document. :-) Use Mime Magic or exec(file /path/to/upload, $output, $error) to find out what kind of document they REALLY uploaded, regardless of what they CLAIM it is in $_FILE['type'] I guess this is not the time to bring up the discussion on including the fileinfo PECL extension into the core as standard thats being waged on the internals mailing list (or that mime magic seems to have been magically relegated to the dustbin)? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Port Block
Christopher Deeley wrote: I used to use mailenable to send e-mails from a site hosted on my computer, to email anyone. Now my ISP blocked port 25 so I can't connect directly to any smtp servers like google to send e-mail directly from my computer. Does anyone know of an open SMTP server which doesn't use port 25? In my experience ISPs do this to force you to use their SMTP server so they can keep an eye on what you are doing. If that is the case all you need to do is find out what their SMTP server details are and set up your machine to send all mail through that. If that is not the case, and your ISP has actually completely blocked outgoing connections on port 25, I suggest you find a new ISP. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calling static child method from inherited static parent method
I'm trying to implement what I think is called a virtual method: my abstract parent class ParentClass defines a method xxx that calls method yyy, but yyy is defined only in ParentClass's children. I can't get this to work (PHP5.0.4). Sample code: === start sample code === abstract class ParentClass { // xxx just returns 5 + whatever yyy() returns public static function xxx () {return 5 + yyy();} // all my children must define yyy() abstract static function yyy(); } abstract class ChildClass extends ParentClass { public static function yyy () {return 7;} } echo ChildClass::xxx(); === end sample code === When I run the above, I get this error: Fatal error: Call to undefined function yyy() in file on line 9 Changing the call from yyy() to self::yyy() gives a different error: Fatal error: Cannot call abstract method ParentClass::yyy() in file on line 9 How to do this correctly? -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that resistance to new ideas and technology is unwise and ultimately futile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] software recommendation: ServiceCapture
I already have one, but this one looks better! I don't want to pay though... On 1/2/07, Paul Novitski [EMAIL PROTECTED] wrote: I've recently discovered a tool that I recommend for web work: ServiceCapture by Kevin Langdon http://kevinlangdon.com/serviceCapture/ It acts as an HTTP proxy, inserting itself between browser and the net, and logs the details of http requests and responses. It's been a great help to me lately while working on a PHP-Flash dialog via AMF-PHP, and will undoubtedly save time on future projects when I need to debug cookies and posts. (This is a spontaneous, unsolicited, uninvested recommendation. I just really like the software and thought you might find it useful.) Regards, Paul __ Juniper Webcraft Ltd. http://juniperwebcraft.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calling static child method from inherited static parent method
===ORIGINAL=== I'm trying to implement what I think is called a virtual method: my abstract parent class ParentClass defines a method xxx that calls method yyy, but yyy is defined only in ParentClass's children. I can't get this to work (PHP5.0.4). Sample code: === start sample code === abstract class ParentClass { // xxx just returns 5 + whatever yyy() returns public static function xxx () {return 5 + yyy();} // all my children must define yyy() abstract static function yyy(); } abstract class ChildClass extends ParentClass { public static function yyy () {return 7;} } echo ChildClass::xxx(); === end sample code === When I run the above, I get this error: Fatal error: Call to undefined function yyy() in file on line 9 Changing the call from yyy() to self::yyy() gives a different error: Fatal error: Cannot call abstract method ParentClass::yyy() in file on line 9 How to do this correctly? ===END ORIGINAL=== The following code works..Reasons: 1. both of your classes are abstract 2. In Parent class you cannot referr to yyy() or self::yyy() cause 'self' points to the same class and calling yyy() searches for a global yyy() function. abstract class ParentClass { // xxx just returns 5 + whatever yyy() returns public function xxx () { return 5 + $this-yyy(); } // all my children must define yyy() abstract function yyy(); } class ChildClass extends ParentClass { public function yyy () { return 7; } } $obj=new ChildClass; echo $obj-xxx(); -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Cart, Web Design, SEO)
Re: [PHP] Removing UTF-8 from text
On 03/01/07, Roman Neuhauser [EMAIL PROTECTED] wrote: It's for Did you know that the syntax is described in the manual? Did you know that PHP has a manual on the web? It's at http://www.php.net/;. Thank you Roman. Yes, I am familiar with the php manual. I've referenced the manual hunderds of times, saving list posts. But sometimes (especially in the course of regular expressions for me) one needs to ask on the list. I am also aware that I am not the only one with regex difficulties- they seem to be a sticky point for many noobs like myself in all computer languages, not just php. Also, the Hebrew translation of the manual is very difficult for me to grasp, so I use the English version. That may not be a problem for you, but it is for me. Dotan Cohen http://what-is-what.com/what_is/eula.html http://technology-sleuth.com/short_answer/how_much_memory_will_i_need_for_my_digital_camera.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
Dotan Cohen wrote: On 03/01/07, Richard Lynch [EMAIL PROTECTED] wrote: Instead of trying to strip the UTF stuff out, try to capture the part you want: preg_match_all('|[^]|ms', $emails, $output); var_dump($output); Richard, I do have a working script now, but I'm intrigued by your regex. Why do you surround the needle with pipes, and what is the ms for? http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php lists what the modifiers do. As others have mentioned, you can use anything as delimiters. Sometimes it's easier to change the delimiter rather than worrying about escaping it - for example when doing a regex for urls.. so instead of: /http:\/\/ etc etc / (hard to read) change the delimiters: #http:// etc etc # -- 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] Temporary Emails - Your Recommendations - An Appeal to the PHP Community
Hi, You can use gmail account to receive as many mails as you want on different email addresses with one account. For example my email address is [EMAIL PROTECTED] I can receive email at [EMAIL PROTECTED] and [EMAIL PROTECTED] I love this feature especially when I am testing the signup process of any web application bcoz usualy we do not allow users to create more than one account with the same email address ;) -- Shafiq Rehman Zend Certified Engineer http://phpgurru.com, http://shafiq.pk On 1/3/07, Richard Lynch [EMAIL PROTECTED] wrote: On Mon, January 1, 2007 4:26 am, Jason Paschal wrote: i realize this isn't the appropriate mailing list and i risk being black-listed (flame, defamed, ignored, etc.). i occasionally use temporary emails when registering for forums or to get some shareware (we've all done it, don't give me that look, i have given what i could, when i could) and while i like the way mytrashmail.com works, i don't like having mytrashmail.com as part of the temp addy. does anyone know of a similar service that uses a more enticing domain? Yahoo.com? Hotmail.com? Or, since you control your own domain name, presumably, use something like: [EMAIL PROTECTED] when you give your email to jpaschal.com and use [EMAIL PROTECTED] when you give your email to example.com and... You can set up your email with catchall, or you can just set up the email alias for as long as you need it to exist, and nuke it later or... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
# [EMAIL PROTECTED] / 2007-01-04 08:21:37 +0200: On 03/01/07, Roman Neuhauser [EMAIL PROTECTED] wrote: It's for Did you know that the syntax is described in the manual? Did you know that PHP has a manual on the web? It's at http://www.php.net/;. Thank you Roman. Yes, I am familiar with the php manual. I've referenced the manual hunderds of times, saving list posts. But sometimes (especially in the course of regular expressions for me) one needs to ask on the list. I am also aware that I am not the only one with regex difficulties- they seem to be a sticky point for many noobs like myself in all computer languages, not just php. Also, the Hebrew translation of the manual is very difficult for me to grasp, so I use the English version. That may not be a problem for you, but it is for me. Your written English is very good. If you can understand what you wrote and can read replies (in English) from the list, you should have no problems understanding the manual. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing UTF-8 from text
On 04/01/07, Roman Neuhauser [EMAIL PROTECTED] wrote: Your written English is very good. If you can understand what you wrote and can read replies (in English) from the list, you should have no problems understanding the manual. Thank you. Like said, I do prefer the English manual over the Hebrew one. I'll not argue with you, rather, I was making the point that even people who RTFM and STFA (like myself) need clarification and ask questions. Dotan Cohen http://dotancohen.com/eng/israel_attacks.php http://lyricslist.com/lyrics/lyrics/5/445/sepultura/schizophrenia.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE, Word documents and Content Types
# [EMAIL PROTECTED] / 2007-01-03 15:48:31 -0600: On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote: I have a form where a user can upload different types of documents. A valid file type they will be able to upload is a Word Document. However, when I view the $_FILES 'type' of a word document in Internet Explorer, it says it's type 'application/octet-stream' instead of 'application/msword' or 'application/vnd.ms-word'. It works fine in Firefox and Safari. Any ideas why IE does this and/or how I might be able to get around this? IE does this because MS is not interested in interoperability. Back this statements with some references, will you? Note that application/octet-stream is valid for any kind of document whatsoever for an upload. For output, that would require the browser to download the document rather than attempt to display it. More on that here: http://richardlynch.blogspot.com/ To the OP: read that rant for amusement, but don't use the advice rlynch gives, it's nonsense. If you don't believe me, check the RFCs yourself. http://marc.theaimsgroup.com/?l=php-generalm=116626545820302w=2 http://marc.theaimsgroup.com/?l=php-generalm=116649130605303w=2 -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php