php-general Digest 29 Apr 2009 23:59:59 -0000 Issue 6094
php-general Digest 29 Apr 2009 23:59:59 - Issue 6094 Topics (messages 292122 through 292136): Re: E-Mail Verification - Yes, I know 292122 by: Simon 292123 by: Al 292124 by: Bob McConnell Boolean Parameter to 3 Options? 292125 by: Matt Neimeyer 292126 by: João Cândido de Souza Neto 292128 by: Philip Thompson 292130 by: Shawn McKenzie 292131 by: Matt Neimeyer Programming Question 292127 by: David Stoltz 292129 by: Kyle Smith Re: $_session/$_cookie trouble 292132 by: Igor Escobar file_get_contents doesn't work on one particular server 292133 by: Brian Dunning 292136 by: Shawn McKenzie Static and/or Dynamic site scraping using PHP 292134 by: 9el Re: utf-8 ? 292135 by: Reese 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--- The SMTP or POP3 protocol (cant remember which) used to support the ability to connect to the server and verify if a username exists before delivering the mail. But this feature was abused and was used for spamming so it is now disabled on all major servers (it's probably disabled by default in all servers anyway). There is no way to verify (without sending an email) if the email will be received in a mailbox. Simon On Tue, Apr 28, 2009 at 11:40 AM, Jay Blanchard jblanch...@pocket.com wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Jay Blanchard wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Use login smtp with authenticate Include Domain Keys and SPF in your message header. Many incoming mail servers use them to verify mail. I've not had one email rejected since using them. ---End Message--- ---BeginMessage--- From: Simon There is no way to verify (without sending an email) if the email will be received in a mailbox. Even that is not a valid test. Most spam filters will discard messages silently, that is without notifying either sender or recipient. So the only real verification is when you receive an actual reply from the recipient. Bob McConnell ---End Message--- ---BeginMessage--- I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt ---End Message--- ---BeginMessage--- Why not this: function doFooBar($doFoo = 0) { switch ($doFoo) { case 2: echo Did Baz; break; case 1: echo Did Foo; break; default: echo Did Bar; break; } } I think in this way you can avoid future problems in case you need to add other options in this param. Hope helps. Matt Neimeyer m...@neimeyer.org escreveu na mensagem news:9077339e0904290942y542c7978neb1cd92af5656...@mail.gmail.com... I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo
[PHP] Re: E-Mail Verification - Yes, I know....
Hello, on 04/28/2009 12:40 PM Jay Blanchard said the following: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? This is exactly what this Open Source PHP class does since many years ago, except that this class can handle grey listing responses. http://www.phpclasses.org/emailvalidation Basically it returns 3 possible responses: valid, invalid, and undetermined. Valid, means the SMTP server would accept the message (although it may reject it later). Invalid means the SMTP server would reject the message. Undetermined means that for message would not be accepted now, but could be accepted later, which is usually what servers that implement greylisting cause. -- 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] Re: Unit Testing
You are right, when doing unit tests you only want to test the functionality of the current class and so if there are errors its easier to track down which class is causing the problem. I personally use an api called SimpleTest for my php testing and what you can do with this is create Mock objects for substituting the objects that you dont need to test. A Mock object is basically a clone of a classes structure which then allows you to do stuff like set the return values of each function or perform tests on the parameters passed to each function. Ive not used PHPUnit so im not sure if you can do something similar. On Mon, Apr 27, 2009 at 7:20 PM, Philip Thompson philthath...@gmail.comwrote: On Apr 27, 2009, at 11:38 AM, Simon wrote: As a programmer, i always test what I'm coding as i code it (mostly to make sure i dont include typos), but i feel it is best to make proper testing once the component is ready and working fine. If your project is large, it might be a good idea to break it in several 'modules' or section if possible and treat each of them as separate projects (testing would be done on a module once this one is ready). You may be interested in looking for information on the net on 'IT project management' which usually describe when is the best time to test according to a certain structure... Simon On Mon, Apr 27, 2009 at 12:16 PM, Nathan Rixham nrix...@gmail.com wrote: Philip Thompson wrote: Hi. I did some searching in the archives, but didn't quite find what I was looking for. Maybe a few of you can assist me... We have an application that's currently in production, but we're constantly modifying/upgrading it. We did not do unit testing early on because of the lack of time. Now that some time has opened up, we're considering unit testing. My question is. is it reasonable to start unit testing at this point in time with the application mostly built? Besides being really time-consuming, what are the pitfalls of starting unit testing at this stage? Thanks in advance, ~Philip maybe a useless answer, but, no pitfalls - just do it - I'm always surprised by my unit test results, its invaluable and it's never too late to start. just think about the next years worth of bugs found by the client not being there! A question I have about unit testing. The point is to test individual units... correct? So, let's say I have this core class which creates instances of other classes. Well, if I only want test the core class, I don't want to instantiate the other classes... correct? Example: ?php // Core.php require ('Class1.php'); require ('Class2.php'); class Core { public function __construct () { $this-class1 = new Class1 ($this); $this-class2 = new Class2 ($this); } } // CoreTest.php require ('../PHPUnit/Framework.php'); require ('../includes/Core.php'); class CoreTest extends PHPUnit_Framework_TestCase { protected function setUp () { $this-core = new Core(); } } ? So, here, Class1 and Class2 will be instantiated. However, I don't really care for them to be so that I can test all the methods in the core class. Is this a perfect example of how the original design of the core class is not conducive to implementing unit tests? Without rewriting the core class, is there a way to test this? Thanks, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developing PHP extensions on Windows with VC++, linking problems
At 08.42 29/04/2009 +1000, Chris wrote: Eugenio Tacchini wrote: Hi all, I had to create a PHP extension and I read this article: http://www.talkphp.com/vbarticles.php?do=articlearticleid=49title=creating-custom-php-extensionshttp://www.talkphp.com/vbarticles.ph...php-extensions Everything worked fine if I keep Debug as Active solution configuration in Build-Configuration managerbut in this way I can only use the extension created on the machine I compiled it. If I choose Release instead of Debug I get a fatal error: dllmain.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '_putwchar' Can you help me? Probably a better place to ask is the php-internals list, all of the people who develop the c code behind php are on there. I tried to ask php-win and internals-win without success; I've just tried internals also, following your advice. Eugenio. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
The SMTP or POP3 protocol (cant remember which) used to support the ability to connect to the server and verify if a username exists before delivering the mail. But this feature was abused and was used for spamming so it is now disabled on all major servers (it's probably disabled by default in all servers anyway). There is no way to verify (without sending an email) if the email will be received in a mailbox. Simon On Tue, Apr 28, 2009 at 11:40 AM, Jay Blanchard jblanch...@pocket.com wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? -- 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: E-Mail Verification - Yes, I know....
Jay Blanchard wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Use login smtp with authenticate Include Domain Keys and SPF in your message header. Many incoming mail servers use them to verify mail. I've not had one email rejected since using them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] E-Mail Verification - Yes, I know....
From: Simon There is no way to verify (without sending an email) if the email will be received in a mailbox. Even that is not a valid test. Most spam filters will discard messages silently, that is without notifying either sender or recipient. So the only real verification is when you receive an actual reply from the recipient. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Boolean Parameter to 3 Options?
I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Boolean Parameter to 3 Options?
Why not this: function doFooBar($doFoo = 0) { switch ($doFoo) { case 2: echo Did Baz; break; case 1: echo Did Foo; break; default: echo Did Bar; break; } } I think in this way you can avoid future problems in case you need to add other options in this param. Hope helps. Matt Neimeyer m...@neimeyer.org escreveu na mensagem news:9077339e0904290942y542c7978neb1cd92af5656...@mail.gmail.com... I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Programming Question
Hi Folks, I'm a PHP newbie - but this question really isn't about PHP per se', it's more about programming in general, and how to do something... I'm redesigning an ASP site with Dreamweaver CS4, so I'll be sticking to using ASP technology The site will use horizontal navigation for the MAIN MENU which will be static, but each page therein will have a vertical sub menu, probably with 2-3 levels deep - which will need to be dynamic. I'm trying to figure out a good way to organize and maintain the submenus. I need each page to know where it is so the breadcrumb trail can be accurate and dynamic. The page/menu will also need to know how to display the correct submenu/level.hopefully this all can be dynamic I also want to avoid query string parameters, such as page.asp?menu=1submenu=3 type stuff. My current thought is to use URL rewriting and a database - but I'm not sure if this is the best route Does anyone have any suggestions? HELP! Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Boolean Parameter to 3 Options?
On Apr 29, 2009, at 11:42 AM, Matt Neimeyer wrote: I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt Unless you're doing a strict comparison (===), it probably won't make a lot of difference. However, if you sent true to the function, I believe it will reach the last else condition. You may revisit all the locations you call it and update them appropriately. Those are my initial thoughts ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Programming Question
David Stoltz wrote: Hi Folks, I'm a PHP newbie - but this question really isn't about PHP per se', it's more about programming in general, and how to do something... I'm redesigning an ASP site with Dreamweaver CS4, so I'll be sticking to using ASP technology The site will use horizontal navigation for the MAIN MENU which will be static, but each page therein will have a vertical sub menu, probably with 2-3 levels deep - which will need to be dynamic. I'm trying to figure out a good way to organize and maintain the submenus. I need each page to know where it is so the breadcrumb trail can be accurate and dynamic. The page/menu will also need to know how to display the correct submenu/level.hopefully this all can be dynamic I also want to avoid query string parameters, such as page.asp?menu=1submenu=3 type stuff. My current thought is to use URL rewriting and a database - but I'm not sure if this is the best route Does anyone have any suggestions? HELP! Thanks At a very basic level I think a database is overkill. I would write some sort of include for the top most menu, that includes a function to generate the sub menus and a breadcrumb trail. This is psuedo-code, but here's the idea: // Include top menu and some functions. include('menu-lib.php'); // Build sub-menu, using my location. echo build_sub_menu('Contact', 'Sales quot; Marketing'); This way you can maintain all the menu/breadcrumb/etc in one file, and have the information you need in each page to generate it. HTH, - Kyle
Re: [PHP] Boolean Parameter to 3 Options?
Philip Thompson wrote: On Apr 29, 2009, at 11:42 AM, Matt Neimeyer wrote: I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt Unless you're doing a strict comparison (===), it probably won't make a lot of difference. However, if you sent true to the function, I believe it will reach the last else condition. You may revisit all the locations you call it and update them appropriately. Those are my initial thoughts ~Philip No, true will match the first condition. If you're using true and false now and just want to add a second option then continue using true/false. Don't mix and match. 1 == true and 2 == true. function doFooBar($doFoo = false) { if($doFoo === 2) { //something } elseif($doFoo === true) { //something true } elseif($doFoo === false) { //something false } } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Boolean Parameter to 3 Options?
On Wed, Apr 29, 2009 at 1:30 PM, Shawn McKenzie nos...@mckenzies.net wrote: Philip Thompson wrote: On Apr 29, 2009, at 11:42 AM, Matt Neimeyer wrote: I have a function that currently takes a boolean value as a parameter. But now I want to expand it to 3 options... So if I have... function doFooBar($doFoo = false) { if($doFoo) { echo Did Foo; } else { echo Did Bar; } } Is it as simple as changing it like follows to avoid having to change existing code that won't use the new values. function doFooBar($doFoo = 0) { if($doFoo == 2) { echo Did Baz; } else if($doFoo == 1) { echo Did Foo; } else { echo Did Bar; } } Something about that disturbs me. Perhaps because any time I think Oh it will be as simple as... it usually isn't. Thanks in advance! Matt Unless you're doing a strict comparison (===), it probably won't make a lot of difference. However, if you sent true to the function, I believe it will reach the last else condition. You may revisit all the locations you call it and update them appropriately. Those are my initial thoughts ~Philip No, true will match the first condition. If you're using true and false now and just want to add a second option then continue using true/false. Don't mix and match. 1 == true and 2 == true. function doFooBar($doFoo = false) { if($doFoo === 2) { //something } elseif($doFoo === true) { //something true } elseif($doFoo === false) { //something false } } Ah. I somehow missed the direction of the typecasting. Not that the documentation isn't completely explicit on the matter but for some reason I was thinking that the bool got cast to 1 or 0... not that the string/number got cast to a bool (following the standards there). Good to know. Thanks Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_session/$_cookie trouble
A few days ago i had a problem similar to their and it was a problem with files with BOM signature... maybe its your case. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 11:00 PM, Gary gwp...@ptd.net wrote: Ok, working code. I'm sure there is some left over code that is not actually working, but I have been playing frankenstein all day. Basically a vistor fills in 3 (only two set so far) inputs to see if they qualify for a rebate. If they do, they can go on to file two to submit their information. This is my first project using $_cookie or $_session. I have done an exercise or two in lessons using them, but this is my first attempt from scratch. File1 of 2 ?php session_start(); ? ?php $_SESSION=array('$sale_value', 'assess_value'); $sale_value=$_POST['sale']; $assess_value=$_POST['assess']; $mil_rate=.03965; $ratio=.51; $present_tax=($assess_value) * ($mil_rate); $correct_tax=($sale_value)*($ratio)*($mil_rate); $savings=($present_tax)-($correct_tax); if ($savings 0.00){ echo 'h2 style=margin:0;color:#ff;Yes, Your property appears to qualify!/h2br /br /'; } if ($savings 0.00){ echo 'h3 style=margin:0;NO, Your property does not appear to qualify. /h3br /br /'; } echo 'According to the information you have enteredbr /';?br / ?php echo You believe your home would today sell for $.number_format($sale_value).br /; echo Your current tax assessment is $.number_format($assess_value).br /; echo 'You live in br /br /'; echo 'According to preliminary calculationsbr /br /'; echo You are currently paying now $.number_format($present_tax, 2).br /br /; echo According to the information you have submitted, your taxes should be $ .number_format($correct_tax, 2).br /; ? br/?php if ($savings 0.00){ echo According to our preliminary calculations, a successful assessment appeal could save you annually on your current real estate taxes. b$ .number_format($savings, 2)./b ; } if ($savings 0.00){ echo 'It does not appear that an appeal would be successful in saving you money this year. If property values in your area continue to decline, you may wish to revisit the issue next year./h3br /br /'; } $_SESSION['sale_value'] ='$sale_value'; $_SESSION['assess_value'] ='$assess_value'; ? p style=font-size:.8em; color:#66;If you feel you have entered incorrect information, hit your browsers back button to re-calculate with the new information/pbr / p style=text-align:center; color:#FF; font-size:1.4em;bImportant Notice!/b/p p style=text-align:center; border:#99 1px solid;This bDOES NOT/b constitute a legal opinion by !br / No information has been submitted./p pIn order to proceed with an assessment appeal, you must contact my office that we may verify all pertinent information regarding your a real estate assessment appeal case/p p To submit this information to , please complete the following form./p form action=sendresult.inc.php method=post First Name input name=fname type=text /br /br / Last Name input name=lname type=text /br /br / Property Street Address input name=street type=text / br /br / Town or City input name=town type=text /br/br / Zip Code input name=zip type=text /br /br / County input name=county type=text /br /br / Phone Number input name=phone type=text /br /br / E-Mail Address input name=email type=text /br /br / input name=$assess_value type=hidden value=$assess_value input name=submit type=submit value=Submit /form File 2 ?php ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $fname=STRIPSLASHES($_POST['fname']); $lname=STRIPSLASHES($_POST['lname']); $street=STRIPSLASHES($_POST['street']); $town=STRIPSLASHES($_POST['town']); $zip=STRIPSLASHES($_POST['zip']); $county=STRIPSLASHES($_POST['county']); $phone=STRIPSLASHES($_POST['phone']); $email=STRIPSLASHES($_POST['email']); $assess_value=$_COOKIE['assess_value']; $sale_value=$_COOKIE['sale_value']; echo Thank you $fname for your submission!br /; echo You have submitted the following information.br /; echo Name:$fname $lnamebr /; echo Address:$street $town $zipbr /; echo Phone Number: $phonebr /; echo E-Mail Address: $emailbr /; echo You believe your home would sell for $; echo $_COOKIE['sale_cookie']; ?br /?php echo Your assessment value is $; echo $_COOKIE['assess_cookie'];?br /?php echo You live in $countybr /; ? /body /html Lists li...@euca.us wrote in message news:49f790ed.5040...@euca.us... Andrew Hucks wrote: $sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). Which
[PHP] file_get_contents doesn't work on one particular server
Howdy all - We have a production server that runs our script fine. We're setting up a test server, and this particular script returns a length of zero: $ctx = stream_context_create(array('http' = array('timeout' = 1200))); // 20 minutes per file $contents = file_get_contents($full_url, 0, $ctx); You can paste the $full_url into a browser and it works fine (it's always a PDF document). It works fine with the same variables on the production server. Is there some configuration option that we've missed that's preventing it from working? Note that this is all https, and I did notice this difference in the phpinfo() but don't know if it's relevant: Production server: PHP 5.2.6 Registered PHP streams: php, file, data, http, ftp, compress.zlib, compress.bzip2, https, ftps, zip Test server: PHP 5.2.9-2 Registered PHP streams: php, file, data, http, ftp, compress.zlib -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Static and/or Dynamic site scraping using PHP
I just got a project to do on PHP of scraping the body items from static sites or just html sites. Could you experts please suggest me some quick resources? I have to make an WP plugin with the data as well. Regards Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: On 4/28/09 4:05 PM, Reese howel...@inkworkswell.com wrote: Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve this display issue? if we're talking about web browsers, they are quite good at automatically choosing fonts that can display the unicode characters it finds in a page. Right, and I figured out the bit that was confusing me earlier: years ago, I read that some encodings such as #0147; and #0148; (curly quotes) should not be used, that #8220; and #8221; should be used instead. I misremembered that, when I looked at the utf-8 charset here: http://www.columbia.edu/kermit/utf8-t1.html I stand apprised and enlightened. I found the encodings for letters G with breve, S with cedilla, and lower case I w/out the dot, too. Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file_get_contents doesn't work on one particular server
Brian Dunning wrote: Howdy all - We have a production server that runs our script fine. We're setting up a test server, and this particular script returns a length of zero: $ctx = stream_context_create(array('http' = array('timeout' = 1200))); // 20 minutes per file $contents = file_get_contents($full_url, 0, $ctx); You can paste the $full_url into a browser and it works fine (it's always a PDF document). It works fine with the same variables on the production server. Is there some configuration option that we've missed that's preventing it from working? Note that this is all https, and I did notice this difference in the phpinfo() but don't know if it's relevant: Production server: PHP 5.2.6 Registered PHP streams: php, file, data, http, ftp, compress.zlib, compress.bzip2, https, ftps, zip Test server: PHP 5.2.9-2 Registered PHP streams: php, file, data, http, ftp, compress.zlib Most likely allow_url_fopen = Off in the test server php.ini. If you had error reporting on it would tell you. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file_get_contents doesn't work on one particular server
Shawn McKenzie wrote: Brian Dunning wrote: Howdy all - We have a production server that runs our script fine. We're setting up a test server, and this particular script returns a length of zero: $ctx = stream_context_create(array('http' = array('timeout' = 1200))); // 20 minutes per file $contents = file_get_contents($full_url, 0, $ctx); You can paste the $full_url into a browser and it works fine (it's always a PDF document). It works fine with the same variables on the production server. Is there some configuration option that we've missed that's preventing it from working? Note that this is all https, and I did notice this difference in the phpinfo() but don't know if it's relevant: Production server: PHP 5.2.6 Registered PHP streams: php, file, data, http, ftp, compress.zlib, compress.bzip2, https, ftps, zip Test server: PHP 5.2.9-2 Registered PHP streams: php, file, data, http, ftp, compress.zlib Most likely allow_url_fopen = Off in the test server php.ini. If you had error reporting on it would tell you. Sorry, didn't pay attention to the registered streams :-( You need to install a PHP package with ssl or compile it with --with-openssl. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DateInterval
Hello, I would like to know how to correctly use DateInterval::format(). The documentation is unclear. Also, I am willing to write some documentation for the DateInterval and DatePeriod if no one has taken the task. Thanks for the help. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DateInterval
Sounds great Mike. I personally would also like to see standard date/time functions (strtotime, strftime, date, etc) support dates greater than 2038. I think this can be done internally by parsing the datetime value swith the DateInterval object and retuning the results to the standard functions. Best regards, __ Raymond Irving --- On Wed, 4/29/09, MIke Alaimo li...@reptiliannature.org wrote: From: MIke Alaimo li...@reptiliannature.org Subject: [PHP] DateInterval To: php-general@lists.php.net Date: Wednesday, April 29, 2009, 8:53 PM Hello, I would like to know how to correctly use DateInterval::format(). The documentation is unclear. Also, I am willing to write some documentation for the DateInterval and DatePeriod if no one has taken the task. Thanks for the help. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Two very useful PHP functions
Hello, Every so often I have to be using the isset() function to check if a variable exists. It would be useful to have something like an ifset() function Instead of doing this $v = isset($input) ? $input : $default; we can do this $v = ifset($input,$default); // returns $input if it exists otherwise it will return $default We could also do the same for the empty() function. So instead of doing this $v = empty($input) ? $default : $input; we can do this $v = ifempty($input,$default); // returns $input if it is not empty otherwise it will return $default What do you think? Can they make it into 5.3? Best regards __ Raymond Irving
Re: [PHP] DateInterval
Here is something i'd like to point out with DateInterval. $dInt = 'PT4320S'; $d = new DateInterval($dInt); var_dump($d); $dz = new DateTimeZone(UTC); $dt = new DateTime('now',$dz); $dt-add($d); var_dump($dt-format(DATE_ATOM)); It appears that running this code fails when it seems like it should work. $dInt = 'PT43200S'; $d = new DateInterval($dInt); var_dump($d); $dz = new DateTimeZone(UTC); $dt = new DateTime('now',$dz); $dt-add($d); var_dump($dt-format(DATE_ATOM)); Please note the first value in $dInt should be 72 minutes, while the later should be 720 minutes or half of a day The PT12H interval seems to work fine. $dInt = 'PT12H'; $d = new DateInterval($dInt); var_dump($d); $dz = new DateTimeZone(UTC); $dt = new DateTime('now',$dz); $dt-add($d); var_dump($dt-format(DATE_ATOM)); Raymond, have you tried using DateTime::modify? It appears to work like strtotime. also DateTime::format works like date. At least as far as I can tell. Mike Raymond Irving wrote: Sounds great Mike. I personally would also like to see standard date/time functions (strtotime, strftime, date, etc) support dates greater than 2038. I think this can be done internally by parsing the datetime value swith the DateInterval object and retuning the results to the standard functions. Best regards, __ Raymond Irving --- On *Wed, 4/29/09, MIke Alaimo /li...@reptiliannature.org/* wrote: From: MIke Alaimo li...@reptiliannature.org Subject: [PHP] DateInterval To: php-general@lists.php.net Date: Wednesday, April 29, 2009, 8:53 PM Hello, I would like to know how to correctly use DateInterval::format(). The documentation is unclear. Also, I am willing to write some documentation for the DateInterval and DatePeriod if no one has taken the task. Thanks for the help. 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] DateInterval
--- On Wed, 4/29/09, MIke Alaimo li...@reptiliannature.org wrote: Raymond, have you tried using DateTime::modify? It appears to work like strtotime. also DateTime::format works like date. At least as far as I can tell. From the little documentation that I've seen it appears that it's similar to strtotime and date but it would be very good if the PHP devs could make strtotime() and date() become wrappers for DateTime::modify and DateTime::format. This way we dont hae to modify our code when moving to a version of PHP that supports the new DateTime class. __ Raymond Irving -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php