php-general Digest 14 Feb 2012 12:28:33 -0000 Issue 7688
php-general Digest 14 Feb 2012 12:28:33 - Issue 7688 Topics (messages 316587 through 316600): Re: questions about $_SERVER 316587 by: Tedd Sperling is it possible to change the html title from the WYSIWYG editor? 316588 by: Haluk Karamete 316590 by: Marc Guay 316594 by: Daniel Brown 316595 by: Daniel Brown 316596 by: Haluk Karamete 316598 by: Bastien 316599 by: Haluk Karamete Re: What is the mnemonic for date()'s Day format? 316589 by: Matijn Woudt 316591 by: Marc Guay 316592 by: Dotan Cohen 316593 by: Dotan Cohen Re: Swiftlet is quite possibly the smallest MVC framework you'll ever use. 316597 by: Elbert F handle file_get_contents timeout including dns lookup time 316600 by: nik600 Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Feb 13, 2012, at 4:10 AM, Stuart Dallas wrote: On 13 Feb 2012, at 06:28, Rui Hu wrote: How PHP sets variables in $_SERVER, say, $DOCUMENT_ROOT? What should I know if I want to modify $_SERVER myself? Once your script starts the superglobals are no different to any other variables, except that they're in scope at all times. That's probably the reason why they are named SuperGlobals. :-) But to be more descriptive, these are simply globals that are predefined by php -- see: http://php.net/manual/en/language.variables.superglobals.php I believe, (please show me otherwise) there are no globals in PHP other than SuperGlobals. Cheers, tedd _ t...@sperling.com http://sperling.com ---End Message--- ---BeginMessage--- you may find it weird, actually very weird, but is the following possible load up a post or page into the admin panel and place something like this in to the editor; ?php //assume exec-PHP already active $current_page_url_here = get_current_url(); echo a href='{$current_page_url_here}?var1=val1'click me/a; if ( $_GET['var1']=='val1' ) { //change the current post's html title to titleval1/title without using javascript/jquery } ? so when the visitor, clicks on the click me, same page reloads but this time, the title reads val1, and that's what search engines see too. and if it is also possible to change, the_title() to be equal to val1, that's even better. But, is such a thing technically possible? Or is it too late at that time to make those changes? Could ob_start in any shape or form be deployed here to achieve this goal? ---End Message--- ---BeginMessage--- Based on the terms you're using it sounds like this is a Wordpress question. You'd have a lot better chances of getting an answer if you query a group of WP gurus/geeks. Marc ---End Message--- ---BeginMessage--- On Mon, Feb 13, 2012 at 15:50, Haluk Karamete halukkaram...@gmail.com wrote: you may find it weird, actually very weird, but is the following possible load up a post or page into the admin panel and place something like this in to the editor; ?php //assume exec-PHP already active $current_page_url_here = get_current_url(); echo a href='{$current_page_url_here}?var1=val1'click me/a; if ( $_GET['var1']=='val1' ) { //change the current post's html title to titleval1/title without using javascript/jquery } ? so when the visitor, clicks on the click me, same page reloads but this time, the title reads val1, and that's what search engines see too. and if it is also possible to change, the_title() to be equal to val1, that's even better. But, is such a thing technically possible? Or is it too late at that time to make those changes? Could ob_start in any shape or form be deployed here to achieve this goal? This is not a WYSIWYG editor question; WYSIWYG editors are things like KompoZer, Dreamweaver, FrontPage, and even web-based things like TinyMCE, et al. That aside, try this very basic example (and expounded) and see if it's what you're trying to achieve: ?php echo 'title'; if (isset($_GET['title'])) { echo $_GET['title']; } else { echo 'The title has not been set!'; } echo '/title'.PHP_EOL; echo 'a href=http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?title=Enter+your+title+hereChange Title/a'.PHP_EOL; ? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ ---End Message--- ---BeginMessage--- On Mon, Feb 13, 2012 at 17:15, Haluk Karamete halukkaram...@gmail.com wrote: Please keep the replies on the list for all to benefit, including the archives. Isn't it TinyMCE considered a WYSIWYG one? but, anyway, that's beside the main point. Indeed. Hence: even web-based things like TinyMCE, et al. To your suggestion... I don't think your
php-general Digest 15 Feb 2012 01:44:15 -0000 Issue 7689
php-general Digest 15 Feb 2012 01:44:15 - Issue 7689 Topics (messages 316601 through 316611): Re: handle file_get_contents timeout including dns lookup time 316601 by: Matijn Woudt 316609 by: Marco Behnke Can php be configured to browse through a proxy? 316602 by: Joan 316603 by: Matijn Woudt Form Post to different domain 316604 by: Rick Dwyer 316605 by: Daniel Brown 316606 by: Rick Dwyer 316607 by: Daniel Brown 316608 by: Rick Dwyer MySQL and PHP weirdness 316610 by: Richard S. Crawford 316611 by: David Robley Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Tue, Feb 14, 2012 at 1:28 PM, nik600 nik...@gmail.com wrote: Dear all i'm trying to handle a max timeout into a file_get_contents request, this is my code: *** client.php *** placed on http://test.foo.com/client.php ?php ini_set('default_socket_timeout',10); $ctx = stream_context_create(array('http' = array('timeout' = 10))); $data = file_get_contents(http://www.foo.com/server.php,0,$ctx); if(!data){ die(error during page request); }else{ echo OK; echo $data; } ? *** server.php *** placed on www.foo.com at http://www.foo.com/server.php ?php sleep(15); echo OK; ? i've noticed that in a standard scenario if i call http://test.foo.com/client.php all works properly and the timeout is handled correctly. But, if i'm experiencing dns lookup problems, the timeout setting is ignored by file_get_contents, or more probably the socket isn't yet estabilished so the counter for timeout doesn't start. I've been able to reproduce this problem on a linux server dropping incoming packets of DNS with this command: (be careful, it will disable you ability to resolve all dns address!): * iptables -A INPUT -p udp --sport 53 -j DROP * iptables -A INPUT -p tcp --sport 53 -j DROP So, the question is: is possible to have a timeout check that includes also dns resolution time? Thanks to all in advance I don't think this is possible with file_get_contents, but it should work if you use cURL and set the CURLOPT_CONNECTTIMEOUT option. - Matijn ---End Message--- ---BeginMessage--- Am 14.02.12 14:55, schrieb Matijn Woudt: On Tue, Feb 14, 2012 at 1:28 PM, nik600 nik...@gmail.com wrote: *** server.php *** placed on www.foo.com at http://www.foo.com/server.php ?php sleep(15); echo OK; ? I don't think this is possible with file_get_contents, but it should work if you use cURL and set the CURLOPT_CONNECTTIMEOUT option. - Matijn That won't help. When you reach the sleep with your request, the connection is already established. What you want is curl with CURLOPT_TIMEOUT max execution time -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz signature.asc Description: OpenPGP digital signature ---End Message--- ---BeginMessage--- There is some information about configuring php to use a proxy when connecting to external urls. According to some sources the proper setup option is by using the stream-context-set-default function ( http://www.php.net/manual/en/function.stream-context-set-default.php) Still I have not been able to find any reference about if it can be set on php.ini (so all the instances of php use it) Also there is this bug that has been assigned since 2010 and still have not changed (29280) https://bugs.php.net/bug.php?id=29280 Any information about this will be well received. Thanks, Joan ---End Message--- ---BeginMessage--- On Tue, Feb 14, 2012 at 5:41 PM, Joan aseq...@gmail.com wrote: There is some information about configuring php to use a proxy when connecting to external urls. According to some sources the proper setup option is by using the stream-context-set-default function ( http://www.php.net/manual/en/function.stream-context-set-default.php) Still I have not been able to find any reference about if it can be set on php.ini (so all the instances of php use it) Also there is this bug that has been assigned since 2010 and still have not changed (29280) https://bugs.php.net/bug.php?id=29280 Any information about this will be well received. Thanks, Joan Hi, AFAIK there's no such setting in php.ini. If you want to have it set allways, you could use the php.ini setting auto_prepend_file to run a simple php script (containing stream_context_set_default) before each php file is parsed. - Matijn ---End Message--- ---BeginMessage--- Hello all. If I have a form on domain A
[PHP] handle file_get_contents timeout including dns lookup time
Dear all i'm trying to handle a max timeout into a file_get_contents request, this is my code: *** client.php *** placed on http://test.foo.com/client.php ?php ini_set('default_socket_timeout',10); $ctx = stream_context_create(array('http' = array('timeout' = 10))); $data = file_get_contents(http://www.foo.com/server.php,0,$ctx); if(!data){ die(error during page request); }else{ echo OK; echo $data; } ? *** server.php *** placed on www.foo.com at http://www.foo.com/server.php ?php sleep(15); echo OK; ? i've noticed that in a standard scenario if i call http://test.foo.com/client.php all works properly and the timeout is handled correctly. But, if i'm experiencing dns lookup problems, the timeout setting is ignored by file_get_contents, or more probably the socket isn't yet estabilished so the counter for timeout doesn't start. I've been able to reproduce this problem on a linux server dropping incoming packets of DNS with this command: (be careful, it will disable you ability to resolve all dns address!): * iptables -A INPUT -p udp --sport 53 -j DROP * iptables -A INPUT -p tcp --sport 53 -j DROP So, the question is: is possible to have a timeout check that includes also dns resolution time? Thanks to all in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] handle file_get_contents timeout including dns lookup time
On Tue, Feb 14, 2012 at 1:28 PM, nik600 nik...@gmail.com wrote: Dear all i'm trying to handle a max timeout into a file_get_contents request, this is my code: *** client.php *** placed on http://test.foo.com/client.php ?php ini_set('default_socket_timeout',10); $ctx = stream_context_create(array('http' = array('timeout' = 10))); $data = file_get_contents(http://www.foo.com/server.php,0,$ctx); if(!data){ die(error during page request); }else{ echo OK; echo $data; } ? *** server.php *** placed on www.foo.com at http://www.foo.com/server.php ?php sleep(15); echo OK; ? i've noticed that in a standard scenario if i call http://test.foo.com/client.php all works properly and the timeout is handled correctly. But, if i'm experiencing dns lookup problems, the timeout setting is ignored by file_get_contents, or more probably the socket isn't yet estabilished so the counter for timeout doesn't start. I've been able to reproduce this problem on a linux server dropping incoming packets of DNS with this command: (be careful, it will disable you ability to resolve all dns address!): * iptables -A INPUT -p udp --sport 53 -j DROP * iptables -A INPUT -p tcp --sport 53 -j DROP So, the question is: is possible to have a timeout check that includes also dns resolution time? Thanks to all in advance I don't think this is possible with file_get_contents, but it should work if you use cURL and set the CURLOPT_CONNECTTIMEOUT option. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can php be configured to browse through a proxy?
There is some information about configuring php to use a proxy when connecting to external urls. According to some sources the proper setup option is by using the stream-context-set-default function ( http://www.php.net/manual/en/function.stream-context-set-default.php) Still I have not been able to find any reference about if it can be set on php.ini (so all the instances of php use it) Also there is this bug that has been assigned since 2010 and still have not changed (29280) https://bugs.php.net/bug.php?id=29280 Any information about this will be well received. Thanks, Joan
Re: [PHP] Can php be configured to browse through a proxy?
On Tue, Feb 14, 2012 at 5:41 PM, Joan aseq...@gmail.com wrote: There is some information about configuring php to use a proxy when connecting to external urls. According to some sources the proper setup option is by using the stream-context-set-default function ( http://www.php.net/manual/en/function.stream-context-set-default.php) Still I have not been able to find any reference about if it can be set on php.ini (so all the instances of php use it) Also there is this bug that has been assigned since 2010 and still have not changed (29280) https://bugs.php.net/bug.php?id=29280 Any information about this will be well received. Thanks, Joan Hi, AFAIK there's no such setting in php.ini. If you want to have it set allways, you could use the php.ini setting auto_prepend_file to run a simple php script (containing stream_context_set_default) before each php file is parsed. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form Post to different domain
Hello all. If I have a form on domain A that uses POST to submit data and I want to submit the form to domain B on an entirely different server, how do I pull the form values (... echo $_POST[myval] returns nothing) from the form at domain B? --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Tue, Feb 14, 2012 at 13:14, Rick Dwyer rpdw...@earthlink.net wrote: Hello all. If I have a form on domain A that uses POST to submit data and I want to submit the form to domain B on an entirely different server, how do I pull the form values (... echo $_POST[myval] returns nothing) from the form at domain B? First (basic, obvious) question: do you have full access to both domains, or is Domain B a third-party site? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Feb 14, 2012, at 1:16 PM, Daniel Brown wrote: On Tue, Feb 14, 2012 at 13:14, Rick Dwyer rpdw...@earthlink.net wrote: Hello all. If I have a form on domain A that uses POST to submit data and I want to submit the form to domain B on an entirely different server, how do I pull the form values (... echo $_POST[myval] returns nothing) from the form at domain B? First (basic, obvious) question: do you have full access to both domains, or is Domain B a third-party site? I only have access to domain B... the one receiving the Form POST. --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Tue, Feb 14, 2012 at 13:36, Rick Dwyer rpdw...@earthlink.net wrote: I only have access to domain B... the one receiving the Form POST. Then all you should need to do is: a.) Verify that Domain A is indeed pointing to Domain B, to the script you expect, as a POST request. b.) In the POST-receiving script on Domain B, try this simple snippet: ?php echo 'pre'.PHP_EOL; var_dump($_POST); die('/pre'); ? That should give you all data from the post request. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
Thanks Dan. As it turned out the reason for not showing the passed values is that I didn't have www in the destination address and the values must have been getting lost when Apache redirected requests without www to the fully formed URL. --Rick On Feb 14, 2012, at 1:39 PM, Daniel Brown wrote: On Tue, Feb 14, 2012 at 13:36, Rick Dwyer rpdw...@earthlink.net wrote: I only have access to domain B... the one receiving the Form POST. Then all you should need to do is: a.) Verify that Domain A is indeed pointing to Domain B, to the script you expect, as a POST request. b.) In the POST-receiving script on Domain B, try this simple snippet: ?php echo 'pre'.PHP_EOL; var_dump($_POST); die('/pre'); ? That should give you all data from the post request. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- 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] handle file_get_contents timeout including dns lookup time
Am 14.02.12 14:55, schrieb Matijn Woudt: On Tue, Feb 14, 2012 at 1:28 PM, nik600 nik...@gmail.com wrote: *** server.php *** placed on www.foo.com at http://www.foo.com/server.php ?php sleep(15); echo OK; ? I don't think this is possible with file_get_contents, but it should work if you use cURL and set the CURLOPT_CONNECTTIMEOUT option. - Matijn That won't help. When you reach the sleep with your request, the connection is already established. What you want is curl with CURLOPT_TIMEOUT max execution time -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz signature.asc Description: OpenPGP digital signature
[PHP] MySQL and PHP weirdness
Bear with me here. I have a problem with PHP and MySQL that's been stumping me for a couple of days now. I'm not even sure how to describe it, so I'll just do my best. There's a row in our bugs database that looks like every other row in the table, but when it's pulled from the database and displayed in PHP, the description field -- which is defined as a mediumtext field -- is displayed as a date field with a value of 12/31/1969. Moreoever, when I use PHPMyAdmin to look at the row directly, the description field has the data that I expect it to. Just for fun, here's the text in question: Quarterly Course Set Up - Spring 2012 (114) Section Course titleCourse Start Date 114MHI214 The Internet and the Future of Patient Care 04/02/2012 114MHI212 Health Information Systems Analysis and Design 04/02/2012 Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer Kremer Instructors; MHI214; Peter Yellowlees MHI212; Robert Balch Per instructions from Rita Smith-Simms - I'm creating this task for myself and based on instructions given which are that all listed courses are now to be backed-up and restored sooner (original course set up time-frame was a month before course starts). Adding instructions - Follow the 52-step quarterly course set up process and information from the course matrix; if matrix incomplete, input information during this set up As you track your time each day, please include in the notes which courses (use project code) you worked on and indicate either working on or completed. Create and notify by 2/15/2012 I've made sure there are no odd characters that would mess up how PHP is displaying the text. I've tried changing the field type from mediumtext to text but this didn't work. If anyone has any ideas as to why this might be happening -- or if I just wasn't clear -- please let me know. -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Twitter: http://twitter.com/underpope Facebook: http://www.facebook.com/underpope Google+: http://gplus.to/underpope
[PHP] Re: MySQL and PHP weirdness
Richard S. Crawford wrote: Bear with me here. I have a problem with PHP and MySQL that's been stumping me for a couple of days now. I'm not even sure how to describe it, so I'll just do my best. There's a row in our bugs database that looks like every other row in the table, but when it's pulled from the database and displayed in PHP, the description field -- which is defined as a mediumtext field -- is displayed as a date field with a value of 12/31/1969. Moreoever, when I use PHPMyAdmin to look at the row directly, the description field has the data that I expect it to. Just for fun, here's the text in question: Quarterly Course Set Up - Spring 2012 (114) Section Course titleCourse Start Date 114MHI214 The Internet and the Future of Patient Care 04/02/2012 114MHI212 Health Information Systems Analysis and Design 04/02/2012 Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer Kremer Instructors; MHI214; Peter Yellowlees MHI212; Robert Balch Per instructions from Rita Smith-Simms - I'm creating this task for myself and based on instructions given which are that all listed courses are now to be backed-up and restored sooner (original course set up time-frame was a month before course starts). Adding instructions - Follow the 52-step quarterly course set up process and information from the course matrix; if matrix incomplete, input information during this set up As you track your time each day, please include in the notes which courses (use project code) you worked on and indicate either working on or completed. Create and notify by 2/15/2012 I've made sure there are no odd characters that would mess up how PHP is displaying the text. I've tried changing the field type from mediumtext to text but this didn't work. If anyone has any ideas as to why this might be happening -- or if I just wasn't clear -- please let me know. If phpmyadmin gives expected results and _your_ code doesn't, I'd be suspicious of your code :-) It might be helpful for you to post relevant part(s) ofthe actual code you are using. Cheers -- David Robley Man who run behind car get exhausted. Today is Sweetmorn, the 46th day of Chaos in the YOLD 3178. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php