php-general Digest 19 Mar 2010 07:06:30 -0000 Issue 6647

2010-03-19 Thread php-general-digest-help

php-general Digest 19 Mar 2010 07:06:30 - Issue 6647

Topics (messages 302972 through 302994):

Re: Spreadsheet_Excel_Reader problem
302972 by: Paul M Foster
302974 by: Paul M Foster
302977 by: Ashley Sheridan
302980 by: Andrew Ballard
302985 by: Paul M Foster

Re: PHP in HTML code
302973 by: Ashley Sheridan
302975 by: Jan G.B.
302976 by: Ashley Sheridan
302978 by: Adam Richardson
302979 by: Jan G.B.
302981 by: Ashley Sheridan
302982 by: Jan G.B.
302983 by: Ashley Sheridan
302984 by: Adam Richardson

web sniffer
302986 by: madunix
302987 by: Ashley Sheridan
302988 by: Adam Richardson
302989 by: madunix
302990 by: Ashley Sheridan
302991 by: Adam Richardson
302992 by: madunix

Re: confirm subscribe to php-gene...@lists.php.net
302993 by: Blake Morgan

Example of good PHP namespace usage?
302994 by: D. Dante Lorenso

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 Thu, Mar 18, 2010 at 09:16:30AM -0700, Mattias Thorslund wrote:

 Paul M Foster wrote:
 I process a lot of CSV files, and what I typically see is that Excel
 will enclose fields which might contain commas in quotes. This gets
 messy. So I finally wrote a C utility which parses the file and yields
 tab-delimited records without the quotes.

 Paul


 And fgetcsv() didn't work for you?

 http://www.php.net/fgetcsv

I wrote my utility (and the infrastructure to process these files) long
before I was working with PHP. For what I do with the files, I must pipe
one operation's results to another process/command to get the final
result. This is impossible with web-based PHP. So I shell out from PHP
to do it. Like this:

// convert original file to tab-delimited
cat maillist.csv | cqf | filter.cq3or4  jones.tab
// filter unwanted fields and reorder fields
mlt3.py nady jones.tab jones.rdb
// build basic DBF file
dbfsak -r mailers.rdb jones.dbf
// append rdb records to DBF file
dbfsak -a jones.rdb jones.dbf

Paul

-- 
Paul M. Foster
---End Message---
---BeginMessage---
On Thu, Mar 18, 2010 at 04:15:33PM +, Ashley Sheridan wrote:

 On Thu, 2010-03-18 at 12:12 -0400, Paul M Foster wrote:
 
 On Thu, Mar 18, 2010 at 08:57:00AM -0700, Tommy Pham wrote:
 
 snip
 
 
  Personally, I find working with fixed widths is best.  The text file
  might be larger but I don't have worry about escaping any type of
  characters ;)
 
 I find this impossible, since I never know the largest width of all the
 fields in a file. And a simple explode() call allows pulling all the
 fields into an array, based on a common delimiter.
 
 Paul
 
 --
 Paul M. Foster
 
 
 
 Explode won't work in the case of a comma in a field value.

That's why I convert the files to tab-delimited first. explode() does
work in that case.

 
 Also, newlines can exist within a field value, so a line in the file doesn't
 equate to a row of data

I've never seen this in the files I receive.

 
 The best way is just to start parsing at the beginning of the file and break 
 it
 into fields one by one from there.
 
 The bit I don't like about characters other than a comma being used in a 
 comma
 separated values file is that you can't automatically tell what character has
 been used as the delimiter. Hence being asked by spreadsheet programs what the
 delimiter is if a comma doesn't give up what it recognises as valid fields.

I've honestly never seen a CSV or Comma-separated Values which used
tabs for delimiters. At that point, it's really not a *comma* separated
value file.

My application for all this is accepting mailing lists from customers
which I have to convert into DBFs for a commercial mailing list program.
Because most of my customers can barely find the on/off switch on their
computers, I never know what I'm going to get. So before I string
together the filters to process the file, I have to actually look at and
analyze the file to find out what it is. Could be a fixed-field length
file, a CSV, a tab-delimited file, or anything in between. Once I've
selected the filters, the sequence they will be put together in, and the
fields from the file I want to capture, I hit the button. After it's all
done, I now have to look at the result to ensure that the requested
fields ended up where they were supposed to.

Paul

-- 
Paul M. Foster
---End Message---
---BeginMessage---
On Thu, 2010-03-18 at 12:57 -0400, Paul M Foster wrote:

 On Thu, Mar 18, 2010 at 04:15:33PM +, Ashley Sheridan wrote:
 
  On Thu, 2010-03-18 at 12:12 -0400, Paul M Foster wrote:
  
  On Thu, Mar 

php-general Digest 19 Mar 2010 21:01:36 -0000 Issue 6648

2010-03-19 Thread php-general-digest-help

php-general Digest 19 Mar 2010 21:01:36 - Issue 6648

Topics (messages 302995 through 303020):

Re: web sniffer
302995 by: Jochen Schultz
302996 by: Peter Lind
302997 by: madunix
303000 by: Jay Blanchard
303001 by: Ashley Sheridan
303002 by: Jochen Schultz
303003 by: Jochen Schultz
303004 by: Rene Veerman

Re: PHP in HTML code
302998 by: Michael A. Peters
302999 by: Peter Lind

any reason *not* to use PEAR DB module when accessing mysql?
303005 by: Robert P. J. Day
303007 by: Ashley Sheridan
303010 by: Paul M Foster
303011 by: Adam Richardson
303012 by: Rene Veerman
303014 by: Nilesh Govindarajan
303015 by: larry.garfieldtech.com
303016 by: Mattias Thorslund
303017 by: Lester Caine
303018 by: Robert P. J. Day

need a free sql table layout diagram app for linux, not phpmyadmin coz it has a 
bug with 7 tables opened in its designer.
303006 by: Rene Veerman
303008 by: Ashley Sheridan
303013 by: Rene Veerman

Re: Example of good PHP namespace usage?
303009 by: Adam Richardson

Event/Exhibition Organizers Management Software
303019 by: Jochem Maas

where to make observations about current PHP manual?
303020 by: Robert P. J. Day

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---
Btw., when you use file_get_contets, is there a good way to tell the 
script to stop recieving the file after let's say 2 seconds - just in 
case the server is not reachable - to avoid using fsockopen?


regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

 I've been trying to read the contents from a particular URL
into a
 string in PHP, and can't get it to work.  any help.

 Thanks

 --
 If there is a way, I will find one...***
 If there is none, I will make one...***
  madunix  **





How have you been trying to do it so far?

There are a couple of ways. file_get_contents() and fopen()
will work on URL's if the right ports are open.

Most usually though cURL is used for this sort of thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com







--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann
---End Message---
---BeginMessage---
You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz jschu...@sportimport.de wrote:
 Btw., when you use file_get_contets, is there a good way to tell the script
 to stop recieving the file after let's say 2 seconds - just in case the
 server is not reachable - to avoid using fsockopen?

 regards
 Jochen

 madunix schrieb:

 okay ..it works now i use
 ?php
 $data=file_get_contents(http://www.my.com;);
 echo $data;
 ?

 On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
 wrote:

 On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk
 wrote:

 On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

 trying http://us3.php.net/manual/en/function.fsockopen.php
 do you a piece of code that  read parts  pages.


 On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:


        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

         I've been trying to read the contents from a particular URL
 into a
         string in PHP, and can't get 

[PHP] Example of good PHP namespace usage?

2010-03-19 Thread D. Dante Lorenso

All,

I want to start using PHP namespaces for my projects.  Currently, I name 
my classes similar to how Zend Framework names theirs and I end up with 
classes like:


  LS_Util_String

I'm thinking that if I converted this to namespaces, the classes would 
be named like:


  LS\Util\String

I'd like to look at an example of an open source project that has 
already adopted namespaces as the way to do it and would be a good 
best practices case for how I should go about setting up my library 
namespaces.


I have been playing with concepts of using a Java-like naming convention 
for classes and have created my own namespace like:


com\larkspark\util\String

And here I was thinking that packages would be lowercase and classes 
would be camelcase with initial caps.


I'm getting ready to build a new project and wanted to do it in the 
future-forward style while removing legacy classes and refactoring 
everything to use namespaces.


Any examples out there?  Everything I find from searching Google is 
novice intro to PHP namespaces blogs, but nothing concrete.  Also since 
namespaces are relatively new, I see a lot of misleading guides where 
they are using :: instead of \ to separate class name parts.  What 
does this list recommend?


Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz
Btw., when you use file_get_contets, is there a good way to tell the 
script to stop recieving the file after let's say 2 seconds - just in 
case the server is not reachable - to avoid using fsockopen?


regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

 I've been trying to read the contents from a particular URL
into a
 string in PHP, and can't get it to work.  any help.

 Thanks

 --
 If there is a way, I will find one...***
 If there is none, I will make one...***
  madunix  **





How have you been trying to do it so far?

There are a couple of ways. file_get_contents() and fopen()
will work on URL's if the right ports are open.

Most usually though cURL is used for this sort of thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com







--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] web sniffer

2010-03-19 Thread Peter Lind
You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz jschu...@sportimport.de wrote:
 Btw., when you use file_get_contets, is there a good way to tell the script
 to stop recieving the file after let's say 2 seconds - just in case the
 server is not reachable - to avoid using fsockopen?

 regards
 Jochen

 madunix schrieb:

 okay ..it works now i use
 ?php
 $data=file_get_contents(http://www.my.com;);
 echo $data;
 ?

 On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
 wrote:

 On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk
 wrote:

 On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

 trying http://us3.php.net/manual/en/function.fsockopen.php
 do you a piece of code that  read parts  pages.


 On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:


        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

         I've been trying to read the contents from a particular URL
 into a
         string in PHP, and can't get it to work.  any help.
        
         Thanks
        
         --
         If there is a way, I will find one...***
         If there is none, I will make one...***
          madunix  **
        




        How have you been trying to do it so far?

        There are a couple of ways. file_get_contents() and fopen()
        will work on URL's if the right ports are open.

        Most usually though cURL is used for this sort of thing.

        Thanks,
        Ash
        http://www.ashleysheridan.co.uk







 --
 If there is a way, I will find one...***
 If there is none, I will make one...***
  madunix  **


 I think you're over-complicating things by using fsockopen(). Try one of
 the functions I mentioned in my last email

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk


 I agree with Ashley, use one of the other options and then parse the
 response to get the part of the page you'd like to work with.

 --
 Nephtali:  PHP web framework that functions beautifully
 http://nephtaliproject.com





 --
  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
  Industriestrasse 39 - HRB 1202900            -
  26188 Edewecht      - GF: Michael Müllmann

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] web sniffer

2010-03-19 Thread madunix
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz jschu...@sportimport.de wrote:
 Btw., when you use file_get_contets, is there a good way to tell the script
 to stop recieving the file after let's say 2 seconds - just in case the
 server is not reachable - to avoid using fsockopen?

 regards
 Jochen

 madunix schrieb:

 okay ..it works now i use
 ?php
 $data=file_get_contents(http://www.my.com;);
 echo $data;
 ?

 On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
 wrote:

 On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk
 wrote:

 On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

 trying http://us3.php.net/manual/en/function.fsockopen.php
 do you a piece of code that  read parts  pages.


 On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:


        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

         I've been trying to read the contents from a particular URL
 into a
         string in PHP, and can't get it to work.  any help.
        
         Thanks
        
         --
         If there is a way, I will find one...***
         If there is none, I will make one...***
          madunix  **
        




        How have you been trying to do it so far?

        There are a couple of ways. file_get_contents() and fopen()
        will work on URL's if the right ports are open.

        Most usually though cURL is used for this sort of thing.

        Thanks,
        Ash
        http://www.ashleysheridan.co.uk







 --
 If there is a way, I will find one...***
 If there is none, I will make one...***
  madunix  **


 I think you're over-complicating things by using fsockopen(). Try one of
 the functions I mentioned in my last email

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk


 I agree with Ashley, use one of the other options and then parse the
 response to get the part of the page you'd like to work with.

 --
 Nephtali:  PHP web framework that functions beautifully
 http://nephtaliproject.com





 --
  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
  Industriestrasse 39 - HRB 1202900            -
  26188 Edewecht      - GF: Michael Müllmann




-- 
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP in HTML code

2010-03-19 Thread Michael A. Peters

Jan G.B. wrote:

2010/3/18 tedd tedd.sperl...@gmail.com:

Calling it ranting or religious unjustly demeans the discussion and is
inflammatory.
In all of this, I've simply said it's your choice.


What I said was:
*persons ranting about short open tags* *are just like some religious people
*


I don't care what people do in their code.
I do not like released code with short tags, it has caused me problems 
when trying to run php webapps that use short tags, I have to go through 
the code and change them.


So what people do with their private code, I could care less about.
But if releasing php code for public consumption, I guess I'm a preacher 
asking people to get religion, because short tags do not belong in 
projects that are released to the public. Just like addslashes and magic 
quotes and most html entities should not be used in php code released 
for public consumption.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP in HTML code

2010-03-19 Thread Peter Lind
On 19 March 2010 10:17, Michael A. Peters mpet...@mac.com wrote:

 I don't care what people do in their code.
 I do not like released code with short tags, it has caused me problems when
 trying to run php webapps that use short tags, I have to go through the code
 and change them.

 So what people do with their private code, I could care less about.
 But if releasing php code for public consumption, I guess I'm a preacher
 asking people to get religion, because short tags do not belong in projects
 that are released to the public. Just like addslashes and magic quotes and
 most html entities should not be used in php code released for public
 consumption.


What he said. Now, could we get over this discussion? It's not exactly
going anywhere.

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
/hype

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] web sniffer

2010-03-19 Thread Jay Blanchard
[snip]
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).
[/snip]

Your question is a little too far reaching. You can use string functions
match portions of strings including tried and true regular expressions.

What do you want to do, specifically?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] web sniffer

2010-03-19 Thread Ashley Sheridan
On Fri, 2010-03-19 at 06:25 -0500, Jay Blanchard wrote:

 [snip]
 can any one give a complete sample script how to retrieve data content
 from web (jpg, pdf, field).
 [/snip]
 
 Your question is a little too far reaching. You can use string functions
 match portions of strings including tried and true regular expressions.
 
 What do you want to do, specifically?


I assume he wants to retrieve the files for a page as well.

I'd recommend having PHP call wget on the shell, as that tool was built
for this sort of thing.

If you don't have access to wget, then you could use some sort of DOM or
string manipulation to find out what files are used in a web page and
then make separate requests via cURL to grab those, as
file_get_contents() might not be totally reliable for this sort of
thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz

Maybe this code may help you getting into it?

?php

class simpleHttpSocket {

  public function 
sendHttpRequest($host,$filename,$port=80,$timeout=1,$x=0,$result=array()) {

$header  = 'GET /'.$filename.' HTTP/1.1'.PHP_EOL;
$header .= 'Host: '.$host.PHP_EOL;
$header .= 'Connection: close'.PHP_EOL;
$header .= 'User-Agent: Simple(php-general@lists.php.net)'.PHP_EOL;
$header .= Referer: http://test-server.tld/.PHP_EOL.PHP_EOL;
$sock...@fsockopen($host, $port, $errno, $errstr, $timeout);
$result[-1]='';
if (!$socket){
  trigger_error('Connection timeout',E_USER_NOTICE);
  $result[errno]  = $errno;
  $result[errstr] = $errstr;
  return $result;
}
fputs($socket, $header);
while (!feof($socket)) {
  $result[$x++] = fgets($socket, 128);
  if (preg_match('/^Location:/',$result[$x-1])) {
return $result[$x-1];
  }
  flush();
}
return $result;
  }
}

$post = new simpleHttpSocket;
$host = 'www.example.com';
$filename = '';  // leave empty for index file or else:
// $filename = 'image.jpg';
$file = $post-sendHttpRequest($host,$header,80,2);

// Output
while(list($k,$v)=each($file)) {
  echo $v.'br/';
}

?

regards
Jochen

madunix schrieb:

can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz jschu...@sportimport.de wrote:

Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


   On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

I've been trying to read the contents from a particular URL
into a
string in PHP, and can't get it to work.  any help.
   
Thanks
   
--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **
   




   How have you been trying to do it so far?

   There are a couple of ways. file_get_contents() and fopen()
   will work on URL's if the right ports are open.

   Most usually though cURL is used for this sort of thing.

   Thanks,
   Ash
   http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann







--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] web sniffer

2010-03-19 Thread Jochen Schultz

Thanks alot!

regards
Jochen

Peter Lind schrieb:

You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz jschu...@sportimport.de wrote:

Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:

okay ..it works now i use
?php
$data=file_get_contents(http://www.my.com;);
echo $data;
?

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson simples...@gmail.com
wrote:

On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
a...@ashleysheridan.co.uk
wrote:

On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:

trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:


   On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

I've been trying to read the contents from a particular URL
into a
string in PHP, and can't get it to work.  any help.
   
Thanks
   
--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **
   




   How have you been trying to do it so far?

   There are a couple of ways. file_get_contents() and fopen()
   will work on URL's if the right ports are open.

   Most usually though cURL is used for this sort of thing.

   Thanks,
   Ash
   http://www.ashleysheridan.co.uk







--
If there is a way, I will find one...***
If there is none, I will make one...***
 madunix  **



I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

Thanks,
Ash
http://www.ashleysheridan.co.uk



I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php








--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900-
 26188 Edewecht  - GF: Michael Müllmann

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] web sniffer

2010-03-19 Thread Rene Veerman
field?

On Fri, Mar 19, 2010 at 9:46 AM, madunix madu...@gmail.com wrote:
 can any one give a complete sample script how to retrieve data content
 from web (jpg, pdf, field).


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Robert P. J. Day

  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] need a free sql table layout diagram app for linux, not phpmyadmin coz it has a bug with 7 tables opened in its designer.

2010-03-19 Thread Rene Veerman
https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922

phpmyadmin is on strike :(

can anyone recommend a good alternative? auto-scaling print function preferred.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Ashley Sheridan
On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:

 (just a warning -- as a relative newbie to PHP, i'll probably have
 the occasional dumb question.  just humour me.)
 
   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
 and it's coded using the mysql-specific calls:  mysql_connect,
 mysql_select_db, etc, etc.
 
   is there any reason i *wouldn't* want to rewrite that code using the
 more general PEAR DB module, and use mysqli?  certainly, as i read it,
 using the PEAR DB module would make it easier down the road if i
 suddenly decide to change the DB backend.
 
   anyway, any compelling arguments for or against?
 
 rday
 --
 
 
 
 Robert P. J. Day   Waterloo, Ontario, CANADA
 
 Linux Consulting, Training and Kernel Pedantry.
 
 Web page:  http://crashcourse.ca
 Twitter:   http://twitter.com/rpjday
 
 


The only problem I can foresee is if the system you're looking to
replace the mysql calls in uses any specific mysql-only features and
functions. So, for example, not all database types support grabbing the
last inserted id (and grabbing the MAX(id) is just asking for trouble)

Have a look through the code to see if there any database calls that you
think might throw up any issues. I believe the Pear module supports all
the mysql functions, but there might be issues if you want to change the
back end at some point in the future.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] need a free sql table layout diagram app for linux, not phpmyadmin coz it has a bug with 7 tables opened in its designer.

2010-03-19 Thread Ashley Sheridan
On Fri, 2010-03-19 at 15:25 +0100, Rene Veerman wrote:

 https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922
 
 phpmyadmin is on strike :(
 
 can anyone recommend a good alternative? auto-scaling print function 
 preferred.
 


I needed software to do this a while ago, and the majority of the
responses on the list were to use MySQL Workbench.

The thread was called 'Linux ERD Software' if you want to have a look at
some of the other suggestions.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Example of good PHP namespace usage?

2010-03-19 Thread Adam Richardson
On Fri, Mar 19, 2010 at 3:05 AM, D. Dante Lorenso da...@lorenso.com wrote:

 All,

 I want to start using PHP namespaces for my projects.  Currently, I name my
 classes similar to how Zend Framework names theirs and I end up with classes
 like:

  LS_Util_String

 I'm thinking that if I converted this to namespaces, the classes would be
 named like:

  LS\Util\String

 I'd like to look at an example of an open source project that has already
 adopted namespaces as the way to do it and would be a good best practices
 case for how I should go about setting up my library namespaces.

 I have been playing with concepts of using a Java-like naming convention
 for classes and have created my own namespace like:

com\larkspark\util\String

 And here I was thinking that packages would be lowercase and classes would
 be camelcase with initial caps.

 I'm getting ready to build a new project and wanted to do it in the
 future-forward style while removing legacy classes and refactoring
 everything to use namespaces.

 Any examples out there?  Everything I find from searching Google is novice
 intro to PHP namespaces blogs, but nothing concrete.  Also since namespaces
 are relatively new, I see a lot of misleading guides where they are using
 :: instead of \ to separate class name parts.  What does this list
 recommend?

 Dante

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I'm certainly not advocating my framework's conventions as the way to do
it, but you can certainly look at my code just to see how I'm using
namespaces for my project.  The framework takes a largely functional
approach, so some of the Object-naming conventions aren't present, but you
still might see some things you like (or hate.)  It seems to work well with
Netbeans (I haven't tried other IDE's.)

http://code.google.com/p/nephtali/

Documentation and other stuff can be found at the website in my signature,
if it would help to sift through the functions.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Paul M Foster
On Fri, Mar 19, 2010 at 02:23:30PM +, Ashley Sheridan wrote:

 On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:
 
  (just a warning -- as a relative newbie to PHP, i'll probably have
  the occasional dumb question.  just humour me.)
 
i'm looking at some existing PHP code that accesses a mysql 5.0 db,
  and it's coded using the mysql-specific calls:  mysql_connect,
  mysql_select_db, etc, etc.
 
is there any reason i *wouldn't* want to rewrite that code using the
  more general PEAR DB module, and use mysqli?  certainly, as i read it,
  using the PEAR DB module would make it easier down the road if i
  suddenly decide to change the DB backend.
 
anyway, any compelling arguments for or against?
 
  rday
 
 
 The only problem I can foresee is if the system you're looking to
 replace the mysql calls in uses any specific mysql-only features and
 functions. So, for example, not all database types support grabbing the
 last inserted id (and grabbing the MAX(id) is just asking for trouble)
 
 Have a look through the code to see if there any database calls that you
 think might throw up any issues. I believe the Pear module supports all
 the mysql functions, but there might be issues if you want to change the
 back end at some point in the future.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 

I would suggest instead the built-in PDO module for PHP. This is
generic, and suitable for several DBMS back-ends. But any direct queries
using features unique to a specific DBMS (like Ash's last inserted id)
will have to be coded specifically for your back-end.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Adam Richardson
On Fri, Mar 19, 2010 at 10:23 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:

  (just a warning -- as a relative newbie to PHP, i'll probably have
  the occasional dumb question.  just humour me.)
 
i'm looking at some existing PHP code that accesses a mysql 5.0 db,
  and it's coded using the mysql-specific calls:  mysql_connect,
  mysql_select_db, etc, etc.
 
is there any reason i *wouldn't* want to rewrite that code using the
  more general PEAR DB module, and use mysqli?  certainly, as i read it,
  using the PEAR DB module would make it easier down the road if i
  suddenly decide to change the DB backend.
 
anyway, any compelling arguments for or against?
 
  rday
  --
 
 
  
  Robert P. J. Day   Waterloo, Ontario, CANADA
 
  Linux Consulting, Training and Kernel Pedantry.
 
  Web page:  http://crashcourse.ca
  Twitter:   http://twitter.com/rpjday
  
 


 The only problem I can foresee is if the system you're looking to
 replace the mysql calls in uses any specific mysql-only features and
 functions. So, for example, not all database types support grabbing the
 last inserted id (and grabbing the MAX(id) is just asking for trouble)

 Have a look through the code to see if there any database calls that you
 think might throw up any issues. I believe the Pear module supports all
 the mysql functions, but there might be issues if you want to change the
 back end at some point in the future.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



You also might prefer the level of abstraction and simplicity provided by
PDO (note that it's a data access abstraction layer, not a database
abstraction layer, http://www.php.net/manual/en/intro.pdo.php.)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Rene Veerman
another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, Robert P. J. Day rpj...@crashcourse.ca wrote:

  (just a warning -- as a relative newbie to PHP, i'll probably have
 the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
 and it's coded using the mysql-specific calls:  mysql_connect,
 mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
 more general PEAR DB module, and use mysqli?  certainly, as i read it,
 using the PEAR DB module would make it easier down the road if i
 suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

 rday
 --


 
 Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

 Web page:                                          http://crashcourse.ca
 Twitter:                                       http://twitter.com/rpjday
 

 --
 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] need a free sql table layout diagram app for linux, not phpmyadmin coz it has a bug with 7 tables opened in its designer.

2010-03-19 Thread Rene Veerman
thanks.

On Fri, Mar 19, 2010 at 3:35 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

  On Fri, 2010-03-19 at 15:25 +0100, Rene Veerman wrote:

 https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922

 phpmyadmin is on strike :(

 can anyone recommend a good alternative? auto-scaling print function 
 preferred.



 I needed software to do this a while ago, and the majority of the responses
 on the list were to use MySQL Workbench.

 The thread was called 'Linux ERD Software' if you want to have a look at
 some of the other suggestions.

   Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

On 03/19/2010 08:51 PM, Rene Veerman wrote:

another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, Robert P. J. Dayrpj...@crashcourse.ca  wrote:


  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






Adodb is the same one that is available in Visual Basic.

I suggest PDO. Easy to use and portable.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread la...@garfieldtech.com
Add me to the list of people recommending PDO.  It's much nicer to work 
with than the ext/mysql API, and frankly more secure since you get 
prepared statements.  It won't get you complete database independence 
for a number of reasons (mostly due to databases being too 
unstandardized because they all suck in different ways; I say this as 
someone who has written an abstraction layer atop PDO and it wasn't 
easy), but it will get you part way there and even if you only ever use 
MySQL is a nicer API to work with.


--Larry Garfield

On 3/19/10 9:17 AM, Robert P. J. Day wrote:


   (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

   is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

   anyway, any compelling arguments for or against?

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

 Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Mattias Thorslund

Robert P. J. Day wrote:

  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--
  


Well, the reason you shouldn't use PEAR DB in a new project is that it's 
being deprecated. MDB2 is the PEAR successor, and does provide emulation 
for some features that don't exist on all database platforms, such as 
LastInsertID. It can also help you convert your database from one 
platform to another, since it also provides methods for detecting and 
managing the database structure itself (the Manager and Reverse modules).


That said, if I were to start a new project at this time, I would look 
closer at whether PDO fits my needs.


Cheers,

Mattias

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Lester Caine

la...@garfieldtech.com wrote:

Add me to the list of people recommending PDO.  It's much nicer to work
with than the ext/mysql API, and frankly more secure since you get
prepared statements. It won't get you complete database independence for
a number of reasons (mostly due to databases being too unstandardized
because they all suck in different ways; I say this as someone who has
written an abstraction layer atop PDO and it wasn't easy), but it will
get you part way there and even if you only ever use MySQL is a nicer
API to work with.


Of cause ADODB will actually use PDO for those databases that are currently 
available in it, and the generic drivers for those which are not currently 
supported by PDO ;) One can also check performance by switching between PDO 
driver and generic if you want to ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Robert P. J. Day
On Fri, 19 Mar 2010, Mattias Thorslund wrote:

 Robert P. J. Day wrote:
(just a warning -- as a relative newbie to PHP, i'll probably have
  the occasional dumb question.  just humour me.)
 
i'm looking at some existing PHP code that accesses a mysql 5.0 db,
  and it's coded using the mysql-specific calls:  mysql_connect,
  mysql_select_db, etc, etc.
 
is there any reason i *wouldn't* want to rewrite that code using the
  more general PEAR DB module, and use mysqli?  certainly, as i read it,
  using the PEAR DB module would make it easier down the road if i
  suddenly decide to change the DB backend.
 
anyway, any compelling arguments for or against?
 
  rday
  --
 

 Well, the reason you shouldn't use PEAR DB in a new project is that
 it's being deprecated. MDB2 is the PEAR successor, ...

  you're right and, in fact, i knew that, i just forgot.  i'm also
taking seriously the recommendations for PDO and adodb.

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Event/Exhibition Organizers Management Software

2010-03-19 Thread Jochem Maas
hi gang[tm],

I've been STFW for some kind of CRM package specifically geared at
event/exhibition organizers. I'm not having any luck, there *seems* to
be stuff out there but most of it's geared at single exhibitor/corporate
entity event management as opposed to the organization of events
where 100s of exhibitors need be approached, sold stand space to and
manage - of those that do seem to what I'd like they are a bit vague on
their website and don't give any pricing info (as usual price is a big issue :).

I've looked at the possibilities of using Salesforce or SugarCRM but neither
seem to have plugins/modules aimed at the specific requirements I have.

Basically I want something to manage:

1. multiple expos/exhibitions
2. selling standspace
3. manage tickets/ticket campaigns
4. floorplan management/creation/etc
5. speaker/debate-panel management
6. exhibitor pack/documentation management
5. the usual invoicing/lead/crm stuff

does anyone know of anything that comes remotely close?

rgds,
Jochem

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] where to make observations about current PHP manual?

2010-03-19 Thread Robert P. J. Day

 i don't see a separate mailing list for documentation so is this
where i would point at oddities in the manual?  as in, here:

http://www.php.net/manual/en/language.variables.external.php

we read:

// Unavailable since PHP 6.

that just looks weird, no?

rday
--


Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Michael A. Peters

Mattias Thorslund wrote:

Robert P. J. Day wrote:

  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--
  


Well, the reason you shouldn't use PEAR DB in a new project is that it's 
being deprecated. MDB2 is the PEAR successor, and does provide emulation 
for some features that don't exist on all database platforms, such as 
LastInsertID. It can also help you convert your database from one 
platform to another, since it also provides methods for detecting and 
managing the database structure itself (the Manager and Reverse modules).


That said, if I were to start a new project at this time, I would look 
closer at whether PDO fits my needs.


I use MDB2.
I hear PDO hyped a lot, what does it really give me that MDB2 does not, 
other than making the application dependent upon a binary module?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php compile / configure options

2010-03-19 Thread Gregory Machin
Hi
I'm setting up a development environment that runs multiple versions of php.
I'm looking a list of the compile option options for each php release
other than ./configure --help with more detail on what each option
does.
Any suggestions welcome .

Thank you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-19 Thread Jason Pruim


On Mar 18, 2010, at 1:26 PM, Andrew Ballard wrote:


On Thu, Mar 18, 2010 at 1:00 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
[snip]
And I believe that when MS Office saves a CSV out with a character  
other
than a comma as the delimiter, it still saves it as a .csv by  
default.


Nope. If you save as CSV, it is comma-separated with double-quotes as
the text qualifier. There is also an option to save in tab-delimited
format, but the default extension for that is .txt.

The only issue I have with Excel handling text files is with columns
like ZIP code that should be treated as text (they are string
sequences that happen to contain only numeric digits where leading
zeros are significant) but are interpreted as numbers.

Andrew



Hi Andrew,

As a fellow mailing list processor I can feel your pain... One thing I  
have found is when you are importing the data, you can select the zip  
column and change the format from general to text and it will  
maintain the leading zero's. Or a simple filter applied to it  
afterwards will help to.


But if you have a decent CASS software then it should add the zip back  
in hehe :)



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-19 Thread Ashley Sheridan
On Fri, 2010-03-19 at 18:01 -0400, Jason Pruim wrote:

 On Mar 18, 2010, at 1:26 PM, Andrew Ballard wrote:
 
  On Thu, Mar 18, 2010 at 1:00 PM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  [snip]
  And I believe that when MS Office saves a CSV out with a character  
  other
  than a comma as the delimiter, it still saves it as a .csv by  
  default.
 
  Nope. If you save as CSV, it is comma-separated with double-quotes as
  the text qualifier. There is also an option to save in tab-delimited
  format, but the default extension for that is .txt.
 
  The only issue I have with Excel handling text files is with columns
  like ZIP code that should be treated as text (they are string
  sequences that happen to contain only numeric digits where leading
  zeros are significant) but are interpreted as numbers.
 
  Andrew
 
 
 Hi Andrew,
 
 As a fellow mailing list processor I can feel your pain... One thing I  
 have found is when you are importing the data, you can select the zip  
 column and change the format from general to text and it will  
 maintain the leading zero's. Or a simple filter applied to it  
 afterwards will help to.
 
 But if you have a decent CASS software then it should add the zip back  
 in hehe :)
 
 


It's not really just that. In the csv format, a field value of 00123 (I
don't really know what zip code formats are) is perfectly valid.
Unfortunately, Excel (and Calc) tries to be clever and strips out
leading zeros on a field it recognises as all numbers. This is annoying
for things like zip codes and phone numbers (which in the UK mostly all
start with a 0)

I think short of enclosing the field in quote marks to signify it's a
string and not something that the software should guess at is the only
way to ensure it works effectively.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Re: where to make observations about current PHP manual?

2010-03-19 Thread Shawn McKenzie
Robert P. J. Day wrote:
  i don't see a separate mailing list for documentation so is this
 where i would point at oddities in the manual?  as in, here:
 
 http://www.php.net/manual/en/language.variables.external.php
 
 we read:
 
 // Unavailable since PHP 6.
 
 that just looks weird, no?
 
 rday
 --
 
 
 Robert P. J. Day   Waterloo, Ontario, CANADA
 
 Linux Consulting, Training and Kernel Pedantry.
 
 Web page:  http://crashcourse.ca
 Twitter:   http://twitter.com/rpjday
 

$HTTP_POST_VARS was the way to access post vars in PHP before 4.1. Since
then it is $_POST, and $HTTP_POST_VARS is only available if you set
register_long_arrays = On in php.ini.  As of PHP 6 $HTTP_POST_VARS will
not be available, you must use $_POST.

-- 
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] Spreadsheet_Excel_Reader problem

2010-03-19 Thread Andrew Ballard
On Fri, Mar 19, 2010 at 6:01 PM, Jason Pruim li...@pruimphotography.com wrote:

 On Mar 18, 2010, at 1:26 PM, Andrew Ballard wrote:

 On Thu, Mar 18, 2010 at 1:00 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 [snip]

 And I believe that when MS Office saves a CSV out with a character other
 than a comma as the delimiter, it still saves it as a .csv by default.

 Nope. If you save as CSV, it is comma-separated with double-quotes as
 the text qualifier. There is also an option to save in tab-delimited
 format, but the default extension for that is .txt.

 The only issue I have with Excel handling text files is with columns
 like ZIP code that should be treated as text (they are string
 sequences that happen to contain only numeric digits where leading
 zeros are significant) but are interpreted as numbers.

 Andrew


 Hi Andrew,

 As a fellow mailing list processor I can feel your pain... One thing I have
 found is when you are importing the data, you can select the zip column and
 change the format from general to text and it will maintain the leading
 zero's. Or a simple filter applied to it afterwards will help to.

 But if you have a decent CASS software then it should add the zip back in
 hehe :)



That works - if I'm the first one to open the file. Often I get files
that someone else opened in Excel to fix some things then saved back
to CSV and sent merrily along.  :-)

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-19 Thread Andrew Ballard
On Fri, Mar 19, 2010 at 6:13 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

 On Fri, 2010-03-19 at 18:01 -0400, Jason Pruim wrote:

 On Mar 18, 2010, at 1:26 PM, Andrew Ballard wrote:

  On Thu, Mar 18, 2010 at 1:00 PM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  [snip]
  And I believe that when MS Office saves a CSV out with a character
  other
  than a comma as the delimiter, it still saves it as a .csv by
  default.
 
  Nope. If you save as CSV, it is comma-separated with double-quotes as
  the text qualifier. There is also an option to save in tab-delimited
  format, but the default extension for that is .txt.
 
  The only issue I have with Excel handling text files is with columns
  like ZIP code that should be treated as text (they are string
  sequences that happen to contain only numeric digits where leading
  zeros are significant) but are interpreted as numbers.
 
  Andrew


 Hi Andrew,

 As a fellow mailing list processor I can feel your pain... One thing I
 have found is when you are importing the data, you can select the zip
 column and change the format from general to text and it will
 maintain the leading zero's. Or a simple filter applied to it
 afterwards will help to.

 But if you have a decent CASS software then it should add the zip back
 in hehe :)



 It's not really just that. In the csv format, a field value of 00123 (I don't 
 really know what zip code formats are) is perfectly valid. Unfortunately, 
 Excel (and Calc) tries to be clever and strips out leading zeros on a field 
 it recognises as all numbers. This is annoying for things like zip codes and 
 phone numbers (which in the UK mostly all start with a 0)

 I think short of enclosing the field in quote marks to signify it's a string 
 and not something that the software should guess at is the only way to ensure 
 it works effectively.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



I don't think even that works. I think what Jason suggested (going
through the text import wizard -- which does not always launch if you
just open the CSV file since Excel thinks it knows how to handle it --
and specifying to treat the column as text) is the only way to be
sure.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: where to make observations about current PHP manual?

2010-03-19 Thread Robert P. J. Day
On Fri, 19 Mar 2010, Shawn McKenzie wrote:

 Robert P. J. Day wrote:
   i don't see a separate mailing list for documentation so is this
  where i would point at oddities in the manual?  as in, here:
 
  http://www.php.net/manual/en/language.variables.external.php
 
  we read:
 
  // Unavailable since PHP 6.
 
  that just looks weird, no?
 
  rday

 $HTTP_POST_VARS was the way to access post vars in PHP before 4.1.
 Since then it is $_POST, and $HTTP_POST_VARS is only available if
 you set register_long_arrays = On in php.ini.  As of PHP 6
 $HTTP_POST_VARS will not be available, you must use $_POST.

  i'm not sure that addresses my post -- it doesn't make grammatical
sense to state that something is unavailable since something that is
yet to be officially released.

rday
--



Robert P. J. Day   Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page:  http://crashcourse.ca
Twitter:   http://twitter.com/rpjday


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] where to make observations about current PHP manual?

2010-03-19 Thread Daniel Brown
On Fri, Mar 19, 2010 at 16:59, Robert P. J. Day rpj...@crashcourse.ca wrote:

  i don't see a separate mailing list for documentation so is this
 where i would point at oddities in the manual?  as in, here:

 http://www.php.net/manual/en/language.variables.external.php

 we read:

 // Unavailable since PHP 6.

 that just looks weird, no?

Indeed.  It would probably be better to read, Unavailable as of
PHP 6.  I'll patch that in the XML sources now, and the next time the
manual rebuilds, the changes will take effect.

For the future, please report such things as Documentation
Problems at http://bugs.php.net/.

Thanks for the report, Rob!

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: where to make observations about current PHP manual?

2010-03-19 Thread Daniel Brown
On Fri, Mar 19, 2010 at 20:57, Robert P. J. Day rpj...@crashcourse.ca wrote:

  i'm not sure that addresses my post -- it doesn't make grammatical
 sense to state that something is unavailable since something that is
 yet to be officially released.

In most cases, you'd be absolutely correct but PHP is a
developer-focused open source project, so some folks in the community
do use PHP 6.  If you'd like to be one of them, we'd certainly welcome
the extra help in finding and reporting bugs!  You can always download
the latest snapshot builds at:

http://snaps.php.net/

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] where to make observations about current PHP manual?

2010-03-19 Thread Daniel Brown
On Fri, Mar 19, 2010 at 21:04, Daniel Brown danbr...@php.net wrote:

    Indeed.  It would probably be better to read, Unavailable as of
 PHP 6.  I'll patch that in the XML sources now, and the next time the
 manual rebuilds, the changes will take effect.

Future builds will appear as hinted in the following SVN commit log:

http://news.php.net/php.doc.cvs/6235

Thanks again for the suggestion, Rob.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Looking for hosting or dedicated servers?  Ask me how we can fit your budget!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

On 03/20/2010 02:31 AM, Michael A. Peters wrote:

Mattias Thorslund wrote:

Robert P. J. Day wrote:

(just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question. just humour me.)

i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls: mysql_connect,
mysql_select_db, etc, etc.

is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli? certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

anyway, any compelling arguments for or against?

rday
--


Well, the reason you shouldn't use PEAR DB in a new project is that
it's being deprecated. MDB2 is the PEAR successor, and does provide
emulation for some features that don't exist on all database
platforms, such as LastInsertID. It can also help you convert your
database from one platform to another, since it also provides methods
for detecting and managing the database structure itself (the Manager
and Reverse modules).

That said, if I were to start a new project at this time, I would look
closer at whether PDO fits my needs.


I use MDB2.
I hear PDO hyped a lot, what does it really give me that MDB2 does not,
other than making the application dependent upon a binary module?



binary module makes a lot of difference. If you use MDB2, the
interpreter has to compile MDB2's code along with your program logic.
Whereas PDO is already compiled one, so it will do the job much much faster.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fwd: Re: [PHP] php compile / configure options

2010-03-19 Thread Nilesh Govindarajan

On 03/20/2010 03:16 AM, Gregory Machin wrote:

Hi
I'm setting up a development environment that runs multiple versions of php.
I'm looking a list of the compile option options for each php release
other than ./configure --help with more detail on what each option
does.
Any suggestions welcome .

Thank you.



Its unclear what you want. This mailing list is not get ready made
things, but to get already made things fixed so that they do not produce
errors.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Michael A. Peters

Nilesh Govindarajan wrote:

On 03/20/2010 02:31 AM, Michael A. Peters wrote:

Mattias Thorslund wrote:

Robert P. J. Day wrote:

(just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question. just humour me.)

i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls: mysql_connect,
mysql_select_db, etc, etc.

is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli? certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

anyway, any compelling arguments for or against?

rday
--


Well, the reason you shouldn't use PEAR DB in a new project is that
it's being deprecated. MDB2 is the PEAR successor, and does provide
emulation for some features that don't exist on all database
platforms, such as LastInsertID. It can also help you convert your
database from one platform to another, since it also provides methods
for detecting and managing the database structure itself (the Manager
and Reverse modules).

That said, if I were to start a new project at this time, I would look
closer at whether PDO fits my needs.


I use MDB2.
I hear PDO hyped a lot, what does it really give me that MDB2 does not,
other than making the application dependent upon a binary module?



binary module makes a lot of difference. If you use MDB2, the
interpreter has to compile MDB2's code along with your program logic.
Whereas PDO is already compiled one, so it will do the job much much 
faster.




So since I already cash my db requests via APC the benefits to me would 
be small.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fwd: Re: [PHP] any reason *not* to use PEAR DB module when accessing mysql?

2010-03-19 Thread Nilesh Govindarajan

On 03/20/2010 07:50 AM, Michael A. Peters wrote:

Nilesh Govindarajan wrote:

On 03/20/2010 02:31 AM, Michael A. Peters wrote:

Mattias Thorslund wrote:

Robert P. J. Day wrote:

(just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question. just humour me.)

i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls: mysql_connect,
mysql_select_db, etc, etc.

is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli? certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

anyway, any compelling arguments for or against?

rday
--


Well, the reason you shouldn't use PEAR DB in a new project is that
it's being deprecated. MDB2 is the PEAR successor, and does provide
emulation for some features that don't exist on all database
platforms, such as LastInsertID. It can also help you convert your
database from one platform to another, since it also provides methods
for detecting and managing the database structure itself (the Manager
and Reverse modules).

That said, if I were to start a new project at this time, I would look
closer at whether PDO fits my needs.


I use MDB2.
I hear PDO hyped a lot, what does it really give me that MDB2 does not,
other than making the application dependent upon a binary module?



binary module makes a lot of difference. If you use MDB2, the
interpreter has to compile MDB2's code along with your program logic.
Whereas PDO is already compiled one, so it will do the job much much
faster.



So since I already cash my db requests via APC the benefits to me would
be small.


Yeah the use of APC or Xcache, etc. would not make any difference 
between PDO and MDB2 in terms of performance.


--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php