[PHP] Any Apache Solr Users in the house?
Hi All, I have been working on a PHP extension for Apache Solr for quite sometime now. I just finished testing it and I have completed the initial user level documentation of the API Version 0.9.0-beta has just been released. It already has built-in readiness for Solr 1.4 If you are using Apache Solr 1.3 or later in PHP, I would appreciate if you could check it out and give me some feedback. Thanks in advance. It is very easy to install on UNIX systems. I am still working on the build for windows. It should be available for Windows soon. http://solr.israelekpo.com/manual/en/solr.installation.php A quick list of some of the features of the API include : - Built in serialization of Solr Parameter objects. - Reuse of HTTP connections across repeated requests. - Ability to obtain input documents for possible resubmission from query responses. - Simplified interface to access server response data (SolrObject) - Ability to connect to Solr server instances secured behind HTTP Authentication and proxy servers The following components are also supported - Facets - MoreLikeThis - TermsComponent - Stats - Highlighting Solr PECL Extension Homepage http://pecl.php.net/package/solr Some examples are available here http://solr.israelekpo.com/manual/en/solr.examples.php Interim Documentation Page until refresh of official PHP documentation http://solr.israelekpo.com/manual/en/book.solr.php The C source is available here http://svn.php.net/viewvc/pecl/solr/ -- Good Enough is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
[PHP] Developer Question [DOMDocument]
I'm hoping someone who knows the answer to this question is on this list. I need to modify either libxml2 and/or php DOMDocument to make a small change. Issue - saveHTML() function predates html5 (which isn't even finalized yet) and thus does not know about it's tags. the source element is new in html5 and may not have any children, so when using saveHTML() from DOMDocument, it should NOT add a closing /source tag (it should be handled the same way the param element is handled). It does the right thing with saveXML() where it properly self closes the tag, but it does not do the right thing with saveHTML(). I suspect it is a minor easy to do change, but I don't even have the foggiest idea where to look in the source to make a patch. It's not all that big of a deal, but I would like my server to spit out the correct code without me having to pass it through preg_replace. Thanks for any suggestions on where/how to define that tag in the source. Michael A. Peters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developer Question [DOMDocument]
On Mon, 2009-10-05 at 01:45 -0700, Michael A. Peters wrote: I'm hoping someone who knows the answer to this question is on this list. I need to modify either libxml2 and/or php DOMDocument to make a small change. Issue - saveHTML() function predates html5 (which isn't even finalized yet) and thus does not know about it's tags. the source element is new in html5 and may not have any children, so when using saveHTML() from DOMDocument, it should NOT add a closing /source tag (it should be handled the same way the param element is handled). It does the right thing with saveXML() where it properly self closes the tag, but it does not do the right thing with saveHTML(). I suspect it is a minor easy to do change, but I don't even have the foggiest idea where to look in the source to make a patch. It's not all that big of a deal, but I would like my server to spit out the correct code without me having to pass it through preg_replace. Thanks for any suggestions on where/how to define that tag in the source. Michael A. Peters I've not had a look at DOMDocument myself, having only used DomDocument before (there's a slight difference in the capitalisation of the 2nd and 3rd letters which made it a pain in the proverbial to work with at first!) but I would assume that if it might offer a method by which you could specify certain self closing tags. This would be necessary at least internally, to differentiate between things like param/ which can be self closing and script which can't (even though the latter might only be referencing an external .js file and have no inline code!) If not, then I'd do a file find on the code for any files containing the text 'param' for example, to see if that leads you to the right place. You may have problems doing this on a Windows XP system, as I believe the search function in that OS has some weird behavior with text files that it recognises as being scripts based on the file extension. I know it does that for asp files, but not too sure with php ones. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Developer Question [DOMDocument]
Ashley Sheridan wrote: I've not had a look at DOMDocument myself, having only used DomDocument before (there's a slight difference in the capitalisation of the 2nd and 3rd letters which made it a pain in the proverbial to work with at first!) but I would assume that if it might offer a method by which you could specify certain self closing tags. This would be necessary at least internally, to differentiate between things like param/ which can be self closing and script which can't (even though the latter might only be referencing an external .js file and have no inline code!) saveXML() does self close a script tag with no children. self closing script is only a problem if sent as html, it works when sent with application/xml+xhtml mime type. But you're right, saveHTML() does not do self closing nor /script. If not, then I'd do a file find on the code for any files containing the text 'param' for example, to see if that leads you to the right place. I tried that on libxml2 source - grep -R param didn't work so well, a bazillion files with that use the phrase param. You may have problems doing this on a Windows XP system, I'm on linux. I'll find it eventually. Probably just before upstream does an official html5 patch ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developer Question [DOMDocument]
Michael A. Peters wrote: Ashley Sheridan wrote: I've not had a look at DOMDocument myself, having only used DomDocument before (there's a slight difference in the capitalisation of the 2nd and 3rd letters which made it a pain in the proverbial to work with at first!) but I would assume that if it might offer a method by which you could specify certain self closing tags. This would be necessary at least internally, to differentiate between things like param/ which can be self closing and script which can't (even though the latter might only be referencing an external .js file and have no inline code!) saveXML() does self close a script tag with no children. self closing script is only a problem if sent as html, it works when sent with application/xml+xhtml mime type. But you're right, saveHTML() does not do self closing nor /script. Doh! I was thing meta, script does self close as saveXML() w/ no children but does do /script with saveHTML(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Developer Question [DOMDocument]
saveXML and transform it via XSL It should be simple since basically the only thing you have to do is to replicate everything adding right !DOCTYPE html at the beginning and nothing else. Is this solution suitable for your requirements? Regards Date: Mon, 5 Oct 2009 01:45:03 -0700 From: mpet...@mac.com To: php-general@lists.php.net Subject: [PHP] Developer Question [DOMDocument] I'm hoping someone who knows the answer to this question is on this list. I need to modify either libxml2 and/or php DOMDocument to make a small change. Issue - saveHTML() function predates html5 (which isn't even finalized yet) and thus does not know about it's tags. the source element is new in html5 and may not have any children, so when using saveHTML() from DOMDocument, it should NOT add a closing /source tag (it should be handled the same way the param element is handled). It does the right thing with saveXML() where it properly self closes the tag, but it does not do the right thing with saveHTML(). I suspect it is a minor easy to do change, but I don't even have the foggiest idea where to look in the source to make a patch. It's not all that big of a deal, but I would like my server to spit out the correct code without me having to pass it through preg_replace. Thanks for any suggestions on where/how to define that tag in the source. Michael A. Peters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
Re: [PHP] Developer Question [DOMDocument]
Ashley Sheridan wrote: I've not had a look at DOMDocument myself, having only used DomDocument before (there's a slight difference in the capitalisation of the 2nd and 3rd letters which made it a pain in the proverbial to work with at first!) Did you never notice that PHP has case insensitive class names and function names ? (maybe you did a joke ?) -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developer Question [DOMDocument]
On Mon, 2009-10-05 at 13:36 +0200, Lupus Michaelis wrote: Ashley Sheridan wrote: I've not had a look at DOMDocument myself, having only used DomDocument before (there's a slight difference in the capitalisation of the 2nd and 3rd letters which made it a pain in the proverbial to work with at first!) Did you never notice that PHP has case insensitive class names and function names ? (maybe you did a joke ?) -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org No joke, look it up yourself. DOMDocument is different from DomDocument (the latter is pre PHP 5) I had a lot of issues looking up for help on this, as search engines aren't case-sensitive! Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Developer Question [DOMDocument]
search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
RE: [PHP] Developer Question [DOMDocument]
My apologies I read search engines ARE case sensitive ... never mind, still DomDocument and DOMDocument are the same. Regards From: an_...@hotmail.com To: a...@ashleysheridan.co.uk; mickael+...@lupusmic.org CC: php-general@lists.php.net Date: Mon, 5 Oct 2009 13:59:43 +0200 Subject: RE: [PHP] Developer Question [DOMDocument] search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
RE: [PHP] Developer Question [DOMDocument]
On Mon, 2009-10-05 at 13:59 +0200, Andrea Giammarchi wrote: search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 I never tried to say that classes are case-sensitive, that was actually mentioned by Lupus who misunderstood what I was trying to say. What I was meaning is exactly what you just said here, that the PECL DomDocument is very different from the more typical DOMDocument. I was trying to run code examples that just weren't compatible with the differing classes which was quite frustrating! Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Developer Question [DOMDocument]
Yeah, if it can make you feel better, you are not the only one with some PECL habit, lazily introduced in PHP as core feature changing almost everything. Regards From: a...@ashleysheridan.co.uk To: an_...@hotmail.com CC: mickael+...@lupusmic.org; php-general@lists.php.net Date: Mon, 5 Oct 2009 13:11:12 +0100 Subject: RE: [PHP] Developer Question [DOMDocument] On Mon, 2009-10-05 at 13:59 +0200, Andrea Giammarchi wrote: search engines aren't case-sensitive! ... try to search php.net or PHP.NET in Google and you'll obtain exactly the same result ... in PHP strtolower and strToLower are exactly the same, as the same is DomDocument, DOMDocument, or DOMDOCUMENT, at least in PHP 5.3 If you used an early version (PECL) of the DomDocument it's another story but please change opinion about case sensitive searches or classes ... Regards _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009 I never tried to say that classes are case-sensitive, that was actually mentioned by Lupus who misunderstood what I was trying to say. What I was meaning is exactly what you just said here, that the PECL DomDocument is very different from the more typical DOMDocument. I was trying to run code examples that just weren't compatible with the differing classes which was quite frustrating! Thanks, Ash http://www.ashleysheridan.co.uk _ Windows Live: Make it easier for your friends to see what you’re up to on Facebook. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
Re: [PHP] strtotime strangeness
On Sun, Oct 4, 2009 at 17:00, Floyd Resler fres...@adex-intl.com wrote: Sorry to hear that! I live in Cincinnati so I normally don't get to watch the Colts play when they are on at the same time as the Bengals. But this week I did and, best of all, they won! Yeah, well, the Browns sure didn't, so bite me. I've got the Vikes tonight, though going to be awesome! In any case, as Andrea suggested, make sure your locale settings haven't changed. Check: ?php echo date(Y,$timestamp); ? and ?php echo locale_get_default(); ? -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending HTML email
I've inherited a PHP application, first task of which was relocating to a new server. We've installed and configured all of the files on a dedicated linux server at 1 and 1 (using qmail as an MTA). Since the move, the client is complaining that *some* of the recipients of the HTML email that the server sends out to all of the users are receiving plain HTML code in their mail clients...not the nice, rendered, styled content they intend. It looks fine to me. I found one small error in the HTML that was sent and fixed it (there may be more)... But the client is telling me that this is a new problem as of the server move. Any suggestions which direction to look to try to resolve this? -- John Corry PHP developer - 3by400, Inc http://www.3by400.com
[PHP] SWF Manipulation with PHP
Hi Folks! A very long time ago i spend a little bit of my time to find how i can load a swf file, load an specific frame of that SWF File and save this like a JPG or any other format. I try the ming but it can't load a external swf movie. You only can CREATE a swf. I try the libswf too but i not have a success. Anyone have ANY idea that works? Regards, Igor Escobar Systems Analyst Interface Designer + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar (twitter)
[PHP] Variable name as a variable?
I need to store a variable name as a variable. Note quite a C-style pointer, but a way to access one variable who's name is stored in another variable. As part of a spam-control measure, a certain public-facing form will have dummy rotating text fields and a hidden field that will describe which text field should be considered, like this: input type=text name=text_1 input type=text name=text_2 input type=text name=text_3 input type=hidden name=real_field value=text_2 As this will be a very general-purpose tool, a switch statement on the hidden field's value would not be appropriate here. Naturally, the situation will be much more complex and this is a non-obfuscated generalization of the HTML side of things which should describe the problem that I need to solve on the server side. Thanks in advance for any ideas. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable name as a variable?
On Mon, 2009-10-05 at 16:56 +0200, Dotan Cohen wrote: I need to store a variable name as a variable. Note quite a C-style pointer, but a way to access one variable who's name is stored in another variable. As part of a spam-control measure, a certain public-facing form will have dummy rotating text fields and a hidden field that will describe which text field should be considered, like this: input type=text name=text_1 input type=text name=text_2 input type=text name=text_3 input type=hidden name=real_field value=text_2 As this will be a very general-purpose tool, a switch statement on the hidden field's value would not be appropriate here. Naturally, the situation will be much more complex and this is a non-obfuscated generalization of the HTML side of things which should describe the problem that I need to solve on the server side. Thanks in advance for any ideas. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il What's wrong with this: $user_value = $_REQUEST[$_REQUEST['real_field']]; Obviously this isn't production worthy code, you'd really need to put the whole thing in a ternary if to check if the values actually exist, but this would definitely solve your problem. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Variable name as a variable?
- Original Message From: Dotan Cohen dotanco...@gmail.com To: php-general. php-general@lists.php.net Sent: Mon, October 5, 2009 7:56:48 AM Subject: [PHP] Variable name as a variable? I need to store a variable name as a variable. Note quite a C-style pointer, but a way to access one variable who's name is stored in another variable. As part of a spam-control measure, a certain public-facing form will have dummy rotating text fields and a hidden field that will describe which text field should be considered, like this: input type=text name=text_1 input type=text name=text_2 input type=text name=text_3 input type=hidden name=real_field value=text_2 As this will be a very general-purpose tool, a switch statement on the hidden field's value would not be appropriate here. Naturally, the situation will be much more complex and this is a non-obfuscated generalization of the HTML side of things which should describe the problem that I need to solve on the server side. Thanks in advance for any ideas. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You mean something like this? $var_name = text_2; echo $$var_name; // equivalent to echo $text_2; Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sending HTML email
On Mon, 2009-10-05 at 10:27 -0400, John Corry wrote: I've inherited a PHP application, first task of which was relocating to a new server. We've installed and configured all of the files on a dedicated linux server at 1 and 1 (using qmail as an MTA). Since the move, the client is complaining that *some* of the recipients of the HTML email that the server sends out to all of the users are receiving plain HTML code in their mail clients...not the nice, rendered, styled content they intend. It looks fine to me. I found one small error in the HTML that was sent and fixed it (there may be more)... But the client is telling me that this is a new problem as of the server move. Any suggestions which direction to look to try to resolve this? By any chance are the offending emails all being displayed on Outlook or Outlook Express, specifically version 2002 (part of Office XP) If so, then you may need to change any \r\n into \n only in the headers that are being sent, which seemed to fix the issue for me. Seems that this version of the software has major problems with both characters being used as EOL markers. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Variable name as a variable?
On Mon, 5 Oct 2009 16:56:48 +0200 Dotan Cohen dotanco...@gmail.com wrote: I need to store a variable name as a variable. Note quite a C-style pointer, but a way to access one variable who's name is stored in another variable. As part of a spam-control measure, a certain public-facing form will have dummy rotating text fields and a hidden field that will describe which text field should be considered, like this: input type=text name=text_1 input type=text name=text_2 input type=text name=text_3 input type=hidden name=real_field value=text_2 As this will be a very general-purpose tool, a switch statement on the hidden field's value would not be appropriate here. Naturally, the situation will be much more complex and this is a non-obfuscated generalization of the HTML side of things which should describe the problem that I need to solve on the server side. Thanks in advance for any ideas. Some reading on this if you're interested: http://us2.php.net/manual/en/language.variables.variable.php You can also access array properties using variables if you like: $foo-some_prop = 'Hi there!'; $bar = 'some_prop'; echo $foo-$bar; Regards, Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Self-Process php forms or not?
At 7:25 PM +0100 10/4/09, MEM wrote: Unfortunately, I'm really REALLY on a rush. I saw a bumper sticker the other day which read: Humpty Dumpty was rushed Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header problem
Hi Andrea Andrea Giammarchi wrote on 2009-10-04 19:36: Unless I am missing something, your page has too many if and it always ends up with print something ... but there is no exit after the download, so the zip will have extra output included without a reason ... which is an error, imho, dunno how else explain if you can't see your print links at the end of the page ... Sorry, the .phps file wasn't updated, but the page still works as expected even though I've printed stuff after the header (i tested that just for fun). I'm thinking I'll try and look at the included files, this is what happends before the headers are trown: session_start(); $version_id = $_REQUEST['version_id']; $track_id = $_REQUEST['track_id']; $member_id = $_REQUEST['member_id']; $string = $_REQUEST['string']; $zipfile = $_REQUEST['zipfile']; if($DOWNLOAD_OK) { include inc/connect.inc; include inc/functions.inc; include inc/default_functions.inc; As you said earlier, spaces could do wierd stuff to a header Also switching between utf-8 and latin-1 character sets can make php choke, I've experienced that before with sessions. Kind regards Kim Date: Sun, 4 Oct 2009 19:09:35 +0200 From: php@emax.dk To: php-general@lists.php.net Subject: Re: [PHP] Header problem Hello Andrea Andrea Giammarchi wrote on 2009-10-04 18:49: Header must come first (before you output anything) or you get a parse error I try to better explain ... HTTP works like this: you ask something, you receive something, html and texts are just one option. Got it so far Your example page mess up html, zip, everything, because when you download a file you still have the rest of the page sent in the output. Nops, not really. index.php: print stuff do stuff open download.php in a _new_ window. print more stuff page end this should be possible, right? Two different headers for two different pages. A download should have ONLY file related info/headers and nothing else in the output ... echo/print in the middle of the code before an header is an error, everything in output before an header is an error, everything after headers that is not related to that header is an error, got my point? Jep! And that's actually what I do. What I could, is to add exit; after the headers have been sent and the file have been pushed. I do an update of the database to tell the system that the files in the zipfile has been downloaded. To decide how a page should behave, you must be able to do not produce anything except the expected output with expected headers, that's why I have said headers are fundamental for a response, we cannot play with outputs however we want. The only output is the headers of the zipfile: header('Accept-Ranges: bytes'); header(Content-Type: application/zip); header(Content-Length: $size); header(Content-disposition: attachment; filename=\.basename($zip_filename).\); header(Content-Transfer-Encoding: binary); readfile($filename); // we need to reload top5 to have a current view unset($_SESSION['top5']); $_SESSION['reload_top5'] = 1; // NOTE second param shall be an array, not a variable when downloading zip files download_completed($member_id, $downloaded_version_ids); Wouldn't you say this is okay? As summary, once you have created and tried a dedicated page without a single white space or print before, during, or after the dedicated download stuff, I'll try to understand where is the error. Otherwise it could be everything, and I am against magic behaviors ... you need to download? Well, create a file which aims id to download and nothing else, or you gonna constantly find these kind of problems in your applications. I believe the testpage does forfill that request? Or do you mean otherwise? Kind regards Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header problem
On Mon, 2009-10-05 at 18:10 +0200, Kim Madsen wrote: Hi Andrea Andrea Giammarchi wrote on 2009-10-04 19:36: Unless I am missing something, your page has too many if and it always ends up with print something ... but there is no exit after the download, so the zip will have extra output included without a reason ... which is an error, imho, dunno how else explain if you can't see your print links at the end of the page ... Sorry, the .phps file wasn't updated, but the page still works as expected even though I've printed stuff after the header (i tested that just for fun). I'm thinking I'll try and look at the included files, this is what happends before the headers are trown: session_start(); $version_id = $_REQUEST['version_id']; $track_id = $_REQUEST['track_id']; $member_id = $_REQUEST['member_id']; $string = $_REQUEST['string']; $zipfile = $_REQUEST['zipfile']; if($DOWNLOAD_OK) { include inc/connect.inc; include inc/functions.inc; include inc/default_functions.inc; As you said earlier, spaces could do wierd stuff to a header Also switching between utf-8 and latin-1 character sets can make php choke, I've experienced that before with sessions. Kind regards Kim Date: Sun, 4 Oct 2009 19:09:35 +0200 From: php@emax.dk To: php-general@lists.php.net Subject: Re: [PHP] Header problem Hello Andrea Andrea Giammarchi wrote on 2009-10-04 18:49: Header must come first (before you output anything) or you get a parse error I try to better explain ... HTTP works like this: you ask something, you receive something, html and texts are just one option. Got it so far Your example page mess up html, zip, everything, because when you download a file you still have the rest of the page sent in the output. Nops, not really. index.php: print stuff do stuff open download.php in a _new_ window. print more stuff page end this should be possible, right? Two different headers for two different pages. A download should have ONLY file related info/headers and nothing else in the output ... echo/print in the middle of the code before an header is an error, everything in output before an header is an error, everything after headers that is not related to that header is an error, got my point? Jep! And that's actually what I do. What I could, is to add exit; after the headers have been sent and the file have been pushed. I do an update of the database to tell the system that the files in the zipfile has been downloaded. To decide how a page should behave, you must be able to do not produce anything except the expected output with expected headers, that's why I have said headers are fundamental for a response, we cannot play with outputs however we want. The only output is the headers of the zipfile: header('Accept-Ranges: bytes'); header(Content-Type: application/zip); header(Content-Length: $size); header(Content-disposition: attachment; filename=\.basename($zip_filename).\); header(Content-Transfer-Encoding: binary); readfile($filename); // we need to reload top5 to have a current view unset($_SESSION['top5']); $_SESSION['reload_top5'] = 1; // NOTE second param shall be an array, not a variable when downloading zip files download_completed($member_id, $downloaded_version_ids); Wouldn't you say this is okay? As summary, once you have created and tried a dedicated page without a single white space or print before, during, or after the dedicated download stuff, I'll try to understand where is the error. Otherwise it could be everything, and I am against magic behaviors ... you need to download? Well, create a file which aims id to download and nothing else, or you gonna constantly find these kind of problems in your applications. I believe the testpage does forfill that request? Or do you mean otherwise? Kind regards Kim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009 There's a useful function called headers_sent() which checks to see if the headers have already been sent to the browser. This might be a good place to throw into your code at various points to check and see if something is being written which you don't expect. Also, one method I use, is to write the content you would be 'printing'
RE: [PHP] Header problem
There's a useful function called headers_sent() which checks to see if the headers have already been sent to the browser. This might be a good place to throw into your code at various points to check and see if something is being written which you don't expect. true, check that as well, moreover, you talked about utf-8, well, if the BOM is automatically added, it can cause lots of problems ... still, only if you sent whatever to the output before the download. _ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010
Re: [PHP] Developer Question [DOMDocument]
Ashley Sheridan wrote: I never tried to say that classes are case-sensitive, that was actually mentioned by Lupus who misunderstood what I was trying to say. What I was meaning is exactly what you just said here, that the PECL DomDocument is very different from the more typical DOMDocument. I was trying to run code examples that just weren't compatible with the differing classes which was quite frustrating! Yes - I found instructions that just don't work that were for what I thought was an older version of it, I didn't know the previous version was PECL. Interestingly, it's often not too hard to figure out how to do things in php DOMDocument from tutorials written for the Java implementation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Self-Process php forms or not?
On Oct 2, 2009, at 3:00 AM, Manuel Lemos wrote: Hello, on 10/02/2009 04:41 AM kranthi said the following: I try to avoid the use of hidden form elements as much as possible, especially for tracking whether a user has submitted a form or not... I use name=submit for the submit button instead, that will pass the value of the submit button to the action script. above all i use a template engine, smarty to take care of the presentation for me(like deciding whether to show the form and/or a success/failure message) That only works if the user clicks on that submit button. If the user hits the enter key in a text input, the form is submitted but the submit input variable is not set. That is why an hidden input is a safer solution. If you need the button to be *clicked*... form onsubmit=$('submitButton').fireEvent('click'); ... Or something along those lines. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spry, XML, PHP and XSLT Hell
On Mon, Oct 5, 2009 at 10:10 AM, Matthew Croud m...@obviousdigital.comwrote: Hello, Is there anyone here who uses Spry with XML and PHP and understands XSLT, At the moment i'm in development hell and have a rather bloated question to ask someone who is knowledgeable in the above areas. My head is about to explode and I can't find any answers, If there are Spry/XML folk here i'll spill the beans about my issue. ive not used spry, but have the rest of the lot.., hell, i think we can give it a crack..; lay it on us brother ;) -nathan
Re: [PHP] a trivial little function (PostToHost)
At 12:27 PM -0600 10/4/09, kirk.john...@zootweb.com wrote: tedd tedd.sperl...@gmail.com wrote on 10/04/2009 08:51:13 AM: [PHP] a trivial little function (PostToHost) tedd to: php-general 10/04/2009 09:05 AM Hi gang: The following 'trivial little' function I'm trying to get my head around: http://aspn.activestate.com/ASPN/Mail/Message/php-general/1259426 The article states: Either way, just generate your XML string and fire it at the remote machine. You will need to write code to handle the response, obviously. Okay, so how does one handle the response? I understand that one should have the script at host A sending data to host B, but I can't seem to get it to work. Does anyone have an example that works? My confusion here -- is the data sent by the function at host A accessible by host B via a POST, or does it write to a writable file, or what? Any help would be appreciated. Cheers, tedd Yes, this is just a standard HTTP POST, just like what a browser does when you click a submit button. So, there needs to be a script that handles a standard POST on server B. It will send whatever response it is designed to. Just think of server A as a browser submitting a form and server B is you writing a PHP script to handle the form submission :) Hi Kirk: Okay, but what specifically is that script? I have written a script at server B to print_r($_POST), but I don't get anything other than log errors (see below*). Here's an example: http://www.webbytedd.com/aa/send-form/index.php You can enter anything into the webbytedd.com form (Server A) and click submit, but the php1.net form (Server B) won't show anything -- what am I doing wrong? Cheers, tedd * Log errors: [05-Oct-2009 15:08:54] PHP Warning: PHP Startup: mm_create(0, /session_mm_cgi-fcgi522) failed, err mm:core: failed to open semaphore file (Permission denied) in Unknown on line 0 -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a trivial little function (PostToHost)
tedd tedd.sperl...@gmail.com wrote on 10/05/2009 01:44:00 PM: [snip] Hi Kirk: Okay, but what specifically is that script? I have written a script at server B to print_r($_POST), but I don't get anything other than log errors (see below*). Here's an example: http://www.webbytedd.com/aa/send-form/index.php You can enter anything into the webbytedd.com form (Server A) and click submit, but the php1.net form (Server B) won't show anything -- what am I doing wrong? Cheers, tedd * Log errors: [05-Oct-2009 15:08:54] PHP Warning: PHP Startup: mm_create(0, /session_mm_cgi-fcgi522) failed, err mm:core: failed to open semaphore file (Permission denied) in Unknown on line 0 I am not familiar with this PHP error. Was this on server B? With PHP Startup in the error message, it looks like a setup problem on server B, rather than being related to the PostToHost operation. Once that error is cleared up, start simple for the PostToHost piece. Just have the script on server B return hello,world!, then echo out that response in the script on server A. The PostToHost function you found is correct. Make sure you are passing in valid arguments, so that you end up with a valid HTTP POST message. Kirk
Re: [PHP] Self-Process php forms or not?
Hello, on 10/05/2009 03:02 PM Philip Thompson said the following: I try to avoid the use of hidden form elements as much as possible, especially for tracking whether a user has submitted a form or not... I use name=submit for the submit button instead, that will pass the value of the submit button to the action script. above all i use a template engine, smarty to take care of the presentation for me(like deciding whether to show the form and/or a success/failure message) That only works if the user clicks on that submit button. If the user hits the enter key in a text input, the form is submitted but the submit input variable is not set. That is why an hidden input is a safer solution. If you need the button to be *clicked*... form onsubmit=$('submitButton').fireEvent('click'); ... Or something along those lines. That does not make much sense and is pointless. First that syntax you mentioned probably requires JQuery or some other large Javascript library. something like this['submitButton'].click() would emulate the click event. Second, by the time that onsubmit is called, the event that triggered it was already dispatched. Emulating the click on a button would probably fire the form submission and onsubmit code would be run again, leading to an infinite loop sucking machine CPU. -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do YOU set default function/method params?
Here is a problem that I have had for years now. I have been trying to come up with the perfect solution for this problem. But, I have come down to two different methods for solving it. Here is the problem... ?php function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... # do something here... mail(...); } sendEmail('j...@doe.com', 'maryk...@uhhh.net', 'Hi!', 'Check out my new pictures!!!', $hash_array_of_pictures ); Now, we all have a function or method like this floating around somewhere. My question is, how do YOU go about setting the required entries of the $headers array() ? I see three possible solutions. I want to see a clean and simple solution. Here are my ideas so far: function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... if ( empty($headers['Date']) ) { $headers['Date'] = date('c'); } if ( empty($headers['Message-ID']) ) { $headers['Date'] = md5($to.$subject); } # and the example goes on... # do something here... mail(...); } Or, another example. (I will keep it to the guts of the solution now) $headers['Date'] = empty($headers['Date']) ? date('c') : $headers['Date']; $headers['Message-ID'] = empty($headers['Message-ID']) ? md5($to.$subject) : $headers['Message-ID']; OR, yet another example... $defaults = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject), ); $headers += $defaults; END of examples... Now, IMO, the last one is the simplest one and for me, I think it will be the new way that I solve this type of problem. But, my question that I put out to all of you is... How would you solve this problem? TIA Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SWF Manipulation with PHP
Hello, on 10/05/2009 11:52 AM Igor Escobar said the following: Hi Folks! A very long time ago i spend a little bit of my time to find how i can load a swf file, load an specific frame of that SWF File and save this like a JPG or any other format. I try the ming but it can't load a external swf movie. You only can CREATE a swf. I try the libswf too but i not have a success. Anyone have ANY idea that works? I wonder if it is something like this class that you are looking for: http://www.phpclasses.org/swf_to_jpg There are other PHP Flash solutions here: http://www.phpclasses.org/browse/class/102.html -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do YOU set default function/method params?
On Mon, Oct 5, 2009 at 8:48 PM, Jim Lucas li...@cmsws.com wrote: Here is a problem that I have had for years now. I have been trying to come up with the perfect solution for this problem. But, I have come down to two different methods for solving it. Here is the problem... ?php function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... # do something here... mail(...); } sendEmail('j...@doe.com', 'maryk...@uhhh.net', 'Hi!', 'Check out my new pictures!!!', $hash_array_of_pictures ); Now, we all have a function or method like this floating around somewhere. My question is, how do YOU go about setting the required entries of the $headers array() ? I see three possible solutions. I want to see a clean and simple solution. Here are my ideas so far: function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... if ( empty($headers['Date']) ) { $headers['Date'] = date('c'); } if ( empty($headers['Message-ID']) ) { $headers['Date'] = md5($to.$subject); } # and the example goes on... # do something here... mail(...); } Or, another example. (I will keep it to the guts of the solution now) $headers['Date'] = empty($headers['Date']) ? date('c') : $headers['Date']; $headers['Message-ID'] = empty($headers['Message-ID']) ? md5($to.$subject) : $headers['Message-ID']; OR, yet another example... $defaults = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject), ); $headers += $defaults; END of examples... Now, IMO, the last one is the simplest one and for me, I think it will be the new way that I solve this type of problem. But, my question that I put out to all of you is... How would you solve this problem? TIA Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php How does this look to you? function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... $default_headers = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject) ); $headers = array_merge($default_headers, $headers); # and the example goes on... # do something here... mail(...); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sending HTML email
Hello, on 10/05/2009 11:27 AM John Corry said the following: I've inherited a PHP application, first task of which was relocating to a new server. We've installed and configured all of the files on a dedicated linux server at 1 and 1 (using qmail as an MTA). Since the move, the client is complaining that *some* of the recipients of the HTML email that the server sends out to all of the users are receiving plain HTML code in their mail clients...not the nice, rendered, styled content they intend. It looks fine to me. I found one small error in the HTML that was sent and fixed it (there may be more)... But the client is telling me that this is a new problem as of the server move. Any suggestions which direction to look to try to resolve this? You may want to take a look at this slide presentation. It is from a talk precisely about issues that prevent messages from reaching the destination: http://www.phpclasses.org/browse/video/3/package/9.html Look in special at slide 19, as it presents several reasons that may make your messages be confused with spam. -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do YOU set default function/method params?
Eddie Drapkin wrote: On Mon, Oct 5, 2009 at 8:48 PM, Jim Lucas li...@cmsws.com wrote: Here is a problem that I have had for years now. I have been trying to come up with the perfect solution for this problem. But, I have come down to two different methods for solving it. Here is the problem... ?php function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... # do something here... mail(...); } sendEmail('j...@doe.com', 'maryk...@uhhh.net', 'Hi!', 'Check out my new pictures!!!', $hash_array_of_pictures ); Now, we all have a function or method like this floating around somewhere. My question is, how do YOU go about setting the required entries of the $headers array() ? I see three possible solutions. I want to see a clean and simple solution. Here are my ideas so far: function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... if ( empty($headers['Date']) ) { $headers['Date'] = date('c'); } if ( empty($headers['Message-ID']) ) { $headers['Date'] = md5($to.$subject); } # and the example goes on... # do something here... mail(...); } Or, another example. (I will keep it to the guts of the solution now) $headers['Date'] = empty($headers['Date']) ? date('c') : $headers['Date']; $headers['Message-ID'] = empty($headers['Message-ID']) ? md5($to.$subject) : $headers['Message-ID']; OR, yet another example... $defaults = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject), ); $headers += $defaults; END of examples... Now, IMO, the last one is the simplest one and for me, I think it will be the new way that I solve this type of problem. But, my question that I put out to all of you is... How would you solve this problem? TIA Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php How does this look to you? function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... $default_headers = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject) ); $headers = array_merge($default_headers, $headers); # and the example goes on... # do something here... mail(...); } Good, since it is a combination of the examples I gave. I am looking at how you would solve the problem. Unless this is the way you would solve the problem.. :-D Jim -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A really wacky design decision
On Sun, 4 Oct 2009 14:52:36 +0200, an_...@hotmail.com (Andrea Giammarchi) wrote: $a = 2260; $b = 226e1; $c = 2.26e3; $d = 2260.0; $a==$b==$c==$d, and $b===$c===$d $b , $c, and $d are the same indeed ... they represent the floating point 2260.0 in I think every language ... it's like saying that 1.0 is not 1. ... both floating point numbers, so I don't get your problem ... IF they are actually floating point numbers. My problem is that I'm working with values which are strings, but which sometimes look like either integers or floating point numbers. And I apologise for falsely contradicting your previous message; I realised subsequently that I had forgotten to specify the variables as strings in my test. Thus, if I write: $a = 2260; $b = '2260'; the exact comparison returns 'false'. The same applies to all the cases I had been complaining about, and the exact comparison does indeed work as you stated. This piece of carelessness arose because my data is represented in the simple form, eg: A;e;21TH;APMusical education;090701 but is implicitly converted into strings when it is entered. (And I tend to be wary of determining the rules experimentally. I learned my programming on CDC3200 Fortran fortysomething years ago. Manuals were brief and textbooks non-existent, so whenever we were not sure of something we would try it. Unfortunately the Fortran had some very strange design features, which we learnt about when our employer upgraded to a CDC 6600. This used a much more standard Fortran, and many of the tricks we had discovered no longer worked.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spry, XML, PHP and XSLT Hell
On Tue, Oct 6, 2009 at 4:37 AM, Nathan Nobbe quickshif...@gmail.com wrote: On Mon, Oct 5, 2009 at 10:10 AM, Matthew Croud m...@obviousdigital.comwrote: Hello, Is there anyone here who uses Spry with XML and PHP and understands XSLT, At the moment i'm in development hell and have a rather bloated question to ask someone who is knowledgeable in the above areas. My head is about to explode and I can't find any answers, If there are Spry/XML folk here i'll spill the beans about my issue. ive not used spry, but have the rest of the lot.., hell, i think we can give it a crack..; lay it on us brother ;) -nathan I don't know what spry is but I use PHP and XSLT all the time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do YOU set default function/method params?
why bother, i use available good library http://swiftmailer.org/ On 10/6/09, Jim Lucas li...@cmsws.com wrote: Eddie Drapkin wrote: On Mon, Oct 5, 2009 at 8:48 PM, Jim Lucas li...@cmsws.com wrote: Here is a problem that I have had for years now. I have been trying to come up with the perfect solution for this problem. But, I have come down to two different methods for solving it. Here is the problem... ?php function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... # do something here... mail(...); } sendEmail('j...@doe.com', 'maryk...@uhhh.net', 'Hi!', 'Check out my new pictures!!!', $hash_array_of_pictures ); Now, we all have a function or method like this floating around somewhere. My question is, how do YOU go about setting the required entries of the $headers array() ? I see three possible solutions. I want to see a clean and simple solution. Here are my ideas so far: function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... if ( empty($headers['Date']) ) { $headers['Date'] = date('c'); } if ( empty($headers['Message-ID']) ) { $headers['Date'] = md5($to.$subject); } # and the example goes on... # do something here... mail(...); } Or, another example. (I will keep it to the guts of the solution now) $headers['Date'] = empty($headers['Date']) ? date('c') : $headers['Date']; $headers['Message-ID'] = empty($headers['Message-ID']) ? md5($to.$subject) : $headers['Message-ID']; OR, yet another example... $defaults = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject), ); $headers += $defaults; END of examples... Now, IMO, the last one is the simplest one and for me, I think it will be the new way that I solve this type of problem. But, my question that I put out to all of you is... How would you solve this problem? TIA Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php How does this look to you? function sendEmail( $to, $from, $subject, $body, $attachments=array(), $headers=array() ) { # I typically do not put each argument on seperate lines, but I ran #out of width in this email... $default_headers = array( 'Date' = date('c'), 'Message-ID' = md5($to.$subject) ); $headers = array_merge($default_headers, $headers); # and the example goes on... # do something here... mail(...); } Good, since it is a combination of the examples I gave. I am looking at how you would solve the problem. Unless this is the way you would solve the problem.. :-D Jim -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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