[PHP] Scraping Multiple sites

2010-10-02 Thread Russell Dias
I'm currently stuck on a little problem. I'm using cURL in conjunction with DOMDocument and Xpath to scrape data from a couple of websites. Please note that is only for personal and educational purposes. Right now I have 5 independent scripts (that traverse through 5 websites) that run via a cron

Re: [PHP] What other languages do you use?

2010-10-10 Thread Russell Dias
For me: LAMP stack of course. Javascript and jQuery Python Learning new languages open your mind to a whole new set of possibilities. It also improves the way you code in your language of choice. At this point in time, my goals are one language a year. Eventually I would like to get to a point

Re: [PHP] "My truth comes out" [1]

2010-10-21 Thread Russell Dias
preg_match("/false/i", $string) ? false : true; On Thu, Oct 21, 2010 at 7:39 PM, Gary wrote: > Is there any nice way to convert a string containing either "TRUE" or > "FALSE" to a bool with the appropriate value? I know I can just "if > (strcmp..." but, as the song goes on to say "...ugly, so u

Re: [PHP] "My truth comes out" [1]

2010-10-21 Thread Russell Dias
using settype() on the string? I've not tested it, but it looks > like it should do the trick. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > - Reply message - > From: "Russell Dias" > Date: Thu, Oct 21, 2010 10:51 > Subject: [PHP

Re: [PHP] "My truth comes out" [1]

2010-10-21 Thread Russell Dias
arison. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > - Reply message ----- > From: "Russell Dias" > Date: Thu, Oct 21, 2010 11:03 > Subject: [PHP] "My truth comes out" [1] > To: "a...@ashleysheridan.co.uk" > Cc: &g

Re: [PHP] Re: "My truth comes out" [1]

2010-10-21 Thread Russell Dias
I would stay clear of the ternary operator in nested coditions, for obvious reasons. If it can fit in a single line and is essentially clear in its message I dont see why not to use it. On Thu, Oct 21, 2010 at 8:39 PM, Gary wrote: > Russell Dias wrote: > >> preg_match("/

Re: [PHP] Stripslashes

2010-12-22 Thread Russell Dias
stripslashes() is rife with gaping security holes. For mysql insertion rely on mysql_real_escape_string() or alternatively, you can use prepared statements. For outputting data on the page you should ideally be using htmlspecialchars($var, ENT_QUOTES); cheers, Russ On Thu, Dec 23, 2010 at 6:48

Re: [PHP] $$var

2011-03-06 Thread Russell Dias
Hi Ashim, These are called Variable Variables. Ideally they should be avoided, as they introduce unnecessary legibility issues. This is what it does in a nutshell, it's actually quite simple: $foo = 'bar'; $bar = 'foobar'; echo $$foo;//This prints foobar What it does is, take the value of $