php-general Digest 15 Feb 2012 18:10:10 -0000 Issue 7690
php-general Digest 15 Feb 2012 18:10:10 - Issue 7690 Topics (messages 316612 through 316613): Re: Can php be configured to browse through a proxy? 316612 by: Joan Re: MySQL and PHP weirdness - RESOLVED 316613 by: Richard S. Crawford 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--- Thanks for your answer, it's a pitty that a proxy cannot be specified via php.ini, but anyway. I must say that the information is distributed on many parts of the documentation: .- http://www.php.net/manual/en/context.http.php (for the parameters supported by the http/https context) You get there following this path: function.stream-context-set-default.php - Supported Protocols and Wrappers - wrappers.http.php - context.http.php It's a bit too much, to try to ammend that, I've added a note in the function.stream-context-set-default.php page that should clarify the setup of proxy with default context. I'd be glad if someone had a look on that and revised the code. The code is this: ?php //Code snippet taken from // http://stackoverflow.com/questions/1336262/file-get-contents-behind-a-proxy php $auth = base64_encode('LOGIN:PASSWORD'); $aContext = array( 'http' = array( 'proxy' = 'tcp://192.168.0.2:3128', 'request_fulluri' = true, 'header' = Proxy-Authorization: Basic $auth, ), ); stream_context_set_default($aContext); $sFile = file_get_contents(http://www.google.com;, False); echo $sFile; ? 2012/2/14 Matijn Woudt tijn...@gmail.com 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--- This has been resolved. A previous programmer had snuck in a function that would convert the value of the description field to a date value if it contained the word Date. This has been fixed. On Tue, Feb 14, 2012 at 5:44 PM, David Robley robl...@aapt.net.au wrote: 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
Re: [PHP] Can php be configured to browse through a proxy?
Thanks for your answer, it's a pitty that a proxy cannot be specified via php.ini, but anyway. I must say that the information is distributed on many parts of the documentation: .- http://www.php.net/manual/en/context.http.php (for the parameters supported by the http/https context) You get there following this path: function.stream-context-set-default.php - Supported Protocols and Wrappers - wrappers.http.php - context.http.php It's a bit too much, to try to ammend that, I've added a note in the function.stream-context-set-default.php page that should clarify the setup of proxy with default context. I'd be glad if someone had a look on that and revised the code. The code is this: ?php //Code snippet taken from // http://stackoverflow.com/questions/1336262/file-get-contents-behind-a-proxy php $auth = base64_encode('LOGIN:PASSWORD'); $aContext = array( 'http' = array( 'proxy' = 'tcp://192.168.0.2:3128', 'request_fulluri' = true, 'header' = Proxy-Authorization: Basic $auth, ), ); stream_context_set_default($aContext); $sFile = file_get_contents(http://www.google.com;, False); echo $sFile; ? 2012/2/14 Matijn Woudt tijn...@gmail.com 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
Re: [PHP] Re: MySQL and PHP weirdness - RESOLVED
This has been resolved. A previous programmer had snuck in a function that would convert the value of the description field to a date value if it contained the word Date. This has been fixed. On Tue, Feb 14, 2012 at 5:44 PM, David Robley robl...@aapt.net.au wrote: 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 -- Sláinte, Richard S. Crawford (rich...@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)
[PHP] pathinfo or other
Hello, What is the best way to get the /somedir/ values in the request URI? I tried $t_pathinfo = $_SERVER['PATH_INFO']; but was given an error of undefined index. After looking at the docs, it appears the error derives from something I may have to do in the .ini file. However, is there a standard/better way of grabbing the info after the host and before the query string.. perhaps 'SCRIPT_NAME'? Thanks! Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pathinfo or other
SCRIPT_NAME is a server side path, try REQUEST_URI. This includes the query string but it's easy to remove. Elbert http://swiftlet.org On Thu, Feb 16, 2012 at 8:27 AM, Donovan Brooke li...@euca.us wrote: Hello, What is the best way to get the /somedir/ values in the request URI? I tried $t_pathinfo = $_SERVER['PATH_INFO']; but was given an error of undefined index. After looking at the docs, it appears the error derives from something I may have to do in the .ini file. However, is there a standard/better way of grabbing the info after the host and before the query string.. perhaps 'SCRIPT_NAME'? Thanks! Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php