php-general Digest 23 Dec 2007 14:59:32 -0000 Issue 5196

2007-12-23 Thread php-general-digest-help

php-general Digest 23 Dec 2007 14:59:32 - Issue 5196

Topics (messages 266230 through 266236):

Re: Assign variable to a block of html code
266230 by: php mail

Aspect Oriented framework
266231 by: php mail

html to doc and pdf ??
266232 by: Me2resh Lists

imap_mail()
266233 by: Thomas Le

Sending SMS via PHP
266234 by: AmirBehzad Eslami
266235 by: Casey
266236 by: Bastien Koert

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Hi Everyone,

Thanks for pointing me to heredoc syntax. I've got it working out nicely now
;)

Regards,

Feris

On 12/20/07, Daniel Brown [EMAIL PROTECTED] wrote:

 On Dec 19, 2007 10:38 PM, php mail [EMAIL PROTECTED] wrote:
  Hi All,
 
  Is it possible to assign variable to a block of html code ?
 
  Something like this :
 
  $myblokvar = 
  table width=487 border=0 cellspacing=0 cellpadding=0
tr
  tdtable width=487 border=0 cellspacing=0 cellpadding=0
 [snp]
  /table/td
/tr
  /table
  ;
 
  Although example above is not working, what I want to achieve is
 something
  like that. Is it possible how can I do that ?

 If you absolutely want to do it that way, then escape your quotes
 in the HTML.  When you're using quotes to encapsulate a variable, any
 quotes contained within the value will cause a parse error.  One
 alternative is to use single-quotes for variable containment, and
 double-quotes throughout, or vice-versa.  These two methods will work:

 $variable = This is how you \escape\ quotes.;
 $variable = 'Using single quotes gives you the literal value,
 which means you can't do newlines and such.\n';

 However, your best bet is going to be using HEREDOC:

 $html =EOL

 Always be sure to use the three left carats as shown in the line
 above.  You can call EOL anything you want in the world, as long as it
 doesn't interfere with an existing part of your code within the same
 scope.  You can also use $variables within a HEREDOC, but things like
 newlines WILL NOT work.\n

 Also note that, when using HEREDOC syntax, you don't end the
 EOL with a semicolon.  And when you're done with your HEREDOC
 block, be sure to end it as the first thing on the line.  You can't
 have any spaces, tabs, or other characters before it.  And be sure to
 place your semicolon after it, as well, like so:
 EOL;

 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.

---End Message---
---BeginMessage---
Hi All,

Anyone ever use this tools ? If so, which one is more recommended ?

- http://www.aophp.net/
- http://phpaspect.org/

Regards,

Feris
---End Message---
---BeginMessage---
Dear All,

after suffering with asp.net, i finally convinced the company to turn the
application we are using to PHP
but my concern is,
what is the easiest and best way to convert html that is generated from
mysql databse to microsoft word and pdf files 

the application will run on a linux server

can anyone help please 

any help would be appreciated

thanks in advance,.

Regards,
Me2resh
---End Message---
---BeginMessage---
How do I structure the $additionalHeaders string so that it is useful? Is
there a specific order the headers have to be in? How do I delimit multiple
headers? I want the from and mailed-by fields to be modified by this
variable when mailed from the PHP script. I am getting the server name of my
host instead of the domain name of my site. Minor thing because most people
probably dont look at headers, but I want it to be professional looking in
case someone does.

Thank you,

Thomas Le
Choose a job you love, and you'll never have to work a day in your life. -
Confucius
---End Message---
---BeginMessage---
Hi,

How can i send SMS messages via PHP? How can i set SMS-headers (UDH)?
Does anyone know some article/class/package about this issue?

Thank you in advance,
-b
---End Message---
---BeginMessage---
On Dec 22, 2007 9:00 PM, AmirBehzad Eslami [EMAIL PROTECTED] wrote:
 Hi,

 How can i send SMS messages via PHP? How can i set SMS-headers (UDH)?
 Does anyone know some article/class/package about this issue?

 Thank you in advance,
 -b

You could send emails.
http://en.wikipedia.org/wiki/SMS_gateways#Email_to_SMS
-Casey
---End Message---
---BeginMessage---

Sending proper SMS messges requires that you use an SMS gateway or buy a 
cellular modem. SMS is essentially XML will the message body limited to 160 
characters.

do some googling to get more information

bastien

 Date: Sun, 23 Dec 2007 08:30:29 +0330
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 

php-general Digest 24 Dec 2007 05:02:35 -0000 Issue 5197

2007-12-23 Thread php-general-digest-help

php-general Digest 24 Dec 2007 05:02:35 - Issue 5197

Topics (messages 266237 through 266252):

Re: html to doc and pdf ??
266237 by: Bastien Koert

questions about php's configure script ... (somewhat Mac OS X related)
266238 by: Jochem Maas

PHP interprocesss communication
266239 by: Christophe Gosiau

Try{} Catch()
266240 by: Al
266241 by: Martin Alterisio
266242 by: Al
266243 by: Christophe Gosiau
266250 by: ked

Asynchronous socket connection timing issue.
266244 by: Nicolas Le Gland

Php exec
266245 by: mattias
266246 by: Christophe Gosiau
266248 by: mattias

PHP 5.3.0
266247 by: Jaden Abbott

Re: about __get,__set Overloading, read-only properties
266249 by: ked

is there have something in php that allows method redispatch?
266251 by: Wan Chaowei
266252 by: Wan Chaowei

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

PDF is easy, there are many packages and classes that can convert the html to 
PDFs. A quick google will give you lots of results like

www.fpdf.org
http://www.digitaljunkies.ca/dompdf/

etc

word docs will be harder to create

bastien
_
Discover new ways to stay in touch with Windows Live! Visit the City @ Live 
today!
http://getyourliveid.ca/?icid=LIVEIDENCA006---End Message---
---BeginMessage---
having gone through configure and compile hell getting php built on Mac OS X 
Leopard I have
become a little more familiar with the intricasies of compiling software ... 
undoubtly I
still have a heap to learn.

to that end I was hoping someone could shed some light on the following queries

1. what exactly do --with-libdir and --disable-rpath do and how/when should 
they be used?

2. php's configure says it does not support --disable-dependency-tracking but 
apparently
it's a general configure option that is 'always' available .. is this true? and 
what is it
for? (the entropy.ch php5.2.5.release1 tarball contains a php binary which says 
that this
option was used in it's configure line)

3. how does one build a 64bit version of php? (or better yet a [Mac OS X] 
universal binary)

4. do I need to care about building shared extensions 
(--with-foobar=shared,/usr/local/foobar/),
whats the point unless your release the build for other people to use?
---End Message---
---BeginMessage---

Hi,
I'm trying to write the following program:
A browser connects to an apache web-server where a PHP application is 
running. Most of the actions of the application are Mysql database actions.
There are however also actions that needs to be done on the client side 
but that are not possible inside a browser (output to a display on a 
serial connection, printing to multiple printers...). For these actions 
I wrote a .NET program that is running on the client side and makes a 
TCP connection to a PHP server that is running on the same server as the 
webserver.
This PHP server is a multithreaded server that spawns child threads. 
Every connection from every user is handled by a seperate child thread.


So, on the client side, I have a .NET program with a persistent 
connection to the PHP server and a browser connecting to apache that 
runs a PHP application.
If the user chooses to perform an action that needs to be done on the 
client side (let's say output data to a serial connection), the 
webserver needs to tell the PHP server to send data to the clients .NET 
program (who will makes the final serial connection).


The problems I have with this setup are:
1) How does my PHP application finds out what thread is handling the TCP 
connection according to the user who is logged in into the application?
2) What is the best way to send a command to this thread? Shared Memory? 
Socket Pairs? Named Pipes?
3) Has anyone already made a similar setup or does anyone has good 
documentation about interprocess communication?


thx
Christophe
---End Message---
---BeginMessage---

Try() and Catch() seems neat; but, I've not found it to be very practical.

Anyone using it? How?

Al...
---End Message---
---BeginMessage---
It's not supposed to be practical, it's just a way to handle errors. You
shouldn't rely on try/catch for algorithm implementation.

You create exceptions for errors and unexpected behavior. Then in some other
part of the system you use try/catch to prevent the code from terminating
abruptly. You catch the exception (you should know which exceptions can be
thrown), and act accordingly. Either closing resources, add a log message
with debug information, and/or sending an error message to the user.

2007/12/23, Al [EMAIL PROTECTED]:

 Try() and Catch() seems neat; but, I've not 

RE: [PHP] Sending SMS via PHP

2007-12-23 Thread Bastien Koert

Sending proper SMS messges requires that you use an SMS gateway or buy a 
cellular modem. SMS is essentially XML will the message body limited to 160 
characters.

do some googling to get more information

bastien

 Date: Sun, 23 Dec 2007 08:30:29 +0330
 From: [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Subject: [PHP] Sending SMS via PHP
 
 Hi,
 
 How can i send SMS messages via PHP? How can i set SMS-headers (UDH)?
 Does anyone know some article/class/package about this issue?
 
 Thank you in advance,
 -b

_
Discover new ways to stay in touch with Windows Live! Visit the City @ Live 
today!
http://getyourliveid.ca/?icid=LIVEIDENCA006
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] html to doc and pdf ??

2007-12-23 Thread Bastien Koert

PDF is easy, there are many packages and classes that can convert the html to 
PDFs. A quick google will give you lots of results like

www.fpdf.org
http://www.digitaljunkies.ca/dompdf/

etc

word docs will be harder to create

bastien
_
Discover new ways to stay in touch with Windows Live! Visit the City @ Live 
today!
http://getyourliveid.ca/?icid=LIVEIDENCA006
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] questions about php's configure script ... (somewhat Mac OS X related)

2007-12-23 Thread Jochem Maas
having gone through configure and compile hell getting php built on Mac OS X 
Leopard I have
become a little more familiar with the intricasies of compiling software ... 
undoubtly I
still have a heap to learn.

to that end I was hoping someone could shed some light on the following queries

1. what exactly do --with-libdir and --disable-rpath do and how/when should 
they be used?

2. php's configure says it does not support --disable-dependency-tracking but 
apparently
it's a general configure option that is 'always' available .. is this true? and 
what is it
for? (the entropy.ch php5.2.5.release1 tarball contains a php binary which says 
that this
option was used in it's configure line)

3. how does one build a 64bit version of php? (or better yet a [Mac OS X] 
universal binary)

4. do I need to care about building shared extensions 
(--with-foobar=shared,/usr/local/foobar/),
whats the point unless your release the build for other people to use?

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



[PHP] PHP interprocesss communication

2007-12-23 Thread Christophe Gosiau

Hi,
I'm trying to write the following program:
A browser connects to an apache web-server where a PHP application is 
running. Most of the actions of the application are Mysql database actions.
There are however also actions that needs to be done on the client side 
but that are not possible inside a browser (output to a display on a 
serial connection, printing to multiple printers...). For these actions 
I wrote a .NET program that is running on the client side and makes a 
TCP connection to a PHP server that is running on the same server as the 
webserver.
This PHP server is a multithreaded server that spawns child threads. 
Every connection from every user is handled by a seperate child thread.


So, on the client side, I have a .NET program with a persistent 
connection to the PHP server and a browser connecting to apache that 
runs a PHP application.
If the user chooses to perform an action that needs to be done on the 
client side (let's say output data to a serial connection), the 
webserver needs to tell the PHP server to send data to the clients .NET 
program (who will makes the final serial connection).


The problems I have with this setup are:
1) How does my PHP application finds out what thread is handling the TCP 
connection according to the user who is logged in into the application?
2) What is the best way to send a command to this thread? Shared Memory? 
Socket Pairs? Named Pipes?
3) Has anyone already made a similar setup or does anyone has good 
documentation about interprocess communication?


thx
Christophe

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



[PHP] Try{} Catch()

2007-12-23 Thread Al

Try() and Catch() seems neat; but, I've not found it to be very practical.

Anyone using it? How?

Al...

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



Re: [PHP] Try{} Catch()

2007-12-23 Thread Martin Alterisio
It's not supposed to be practical, it's just a way to handle errors. You
shouldn't rely on try/catch for algorithm implementation.

You create exceptions for errors and unexpected behavior. Then in some other
part of the system you use try/catch to prevent the code from terminating
abruptly. You catch the exception (you should know which exceptions can be
thrown), and act accordingly. Either closing resources, add a log message
with debug information, and/or sending an error message to the user.

2007/12/23, Al [EMAIL PROTECTED]:

 Try() and Catch() seems neat; but, I've not found it to be very practical.

 Anyone using it? How?

 Al...

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




Re: [PHP] Try{} Catch()

2007-12-23 Thread Al
I understand it's intended use and how to use it, have just not found a good use 
for it yet.




Martin Alterisio wrote:

It's not supposed to be practical, it's just a way to handle errors. You
shouldn't rely on try/catch for algorithm implementation.

You create exceptions for errors and unexpected behavior. Then in some other
part of the system you use try/catch to prevent the code from terminating
abruptly. You catch the exception (you should know which exceptions can be
thrown), and act accordingly. Either closing resources, add a log message
with debug information, and/or sending an error message to the user.

2007/12/23, Al [EMAIL PROTECTED]:

Try() and Catch() seems neat; but, I've not found it to be very practical.

Anyone using it? How?

Al...

--
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: Try{} Catch()

2007-12-23 Thread Christophe Gosiau
Try{} catch{} makes more sense when your application is Object Oriented 
and you use the MVC model.
Your library performs some actions but when an error occures, it can't 
write directly to your browser.
Your modules speak with your library and checks if an error occures.. If 
so a decent error message can be shown...



Al schreef:

Try() and Catch() seems neat; but, I've not found it to be very practical.

Anyone using it? How?

Al...


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



[PHP] Asynchronous socket connection timing issue.

2007-12-23 Thread Nicolas Le Gland
Hello everyone here.

This is my first post in this newsgroup, I hope I won't be to much
off-topic. Feel free to redirect me to any better group.


I am getting strange timing issues when failing to asynchronously connect
sockets on closed or filtered ports, but I'm quite unsure if this is a PHP
issue or my misunderstanding, as it seems that socket streams only wrap
around sys/socket.h.

I'm running the latest 5.2.5.5 Windows PHP build downloaded yesterday,
running from the command line without any configuration changed from
default. My code is at http://rafb.net/p/DEwN8J71.html with results at
http://rafb.net/p/cnB4dC80.html


Connecting to an open port seems consistent between synchronous and
asynchronous sockets. Opening the socket is instantaneous, connection
establishes in 0.17 seconds, and closing is fast.

Connecting to a filtered port ends up with a socket timeout, but
asynchronous socket closing blocks for 0.5 second which is quite huge. No
network transfer was captured by Wireshark apart from the initial SYN
packet.

Connecting to a closed port with a synchronous socket times out, with
several retries being sent after the server explicitly refused the
connection with a RST ACK. Why doesn't it simply break after the first try ?

Connecting to a closed port with an asynchronous socket takes the time of a
single try, marking the stream as having had an except in stream_select
after RST ACK was received. But here again, fclose()-ing the resource hangs
for 0.5 second.


Why is that an explicitly refused synchronous connection retries until
timeout ? Why doesn't it cancel instantaneously ?

Why is that closing a failed asynchronous socket takes so much time ? It is
really losing a lot of asynchronous' interest if it hangs that long ?


Note that if I don't explicitly fclose() the resources of failed
asynchronous sockets, the same 0.5 seconds lag appears at the end of the
script execution for each one. I guess PHP cleanly frees resources at
shutdown, but it can reach several seconds when several sockets have failed.

Is there another way than fclose() to clear asynchronous sockets ?


Thank you for any advice.

-- 
Nicolas Le Gland

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



[PHP] Php exec

2007-12-23 Thread mattias
If i use courier-mta
Can i create a php script wich create mailboxes?
And users
Hope any understand

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



[PHP] Re: Php exec

2007-12-23 Thread Christophe Gosiau

Try to configure courier te read his mailboxes/users from mysql?

mattias schreef:

If i use courier-mta
Can i create a php script wich create mailboxes?
And users
Hope any understand


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



[PHP] PHP 5.3.0

2007-12-23 Thread Jaden Abbott
Anyone know when PHP 5.3.0 will be out? 5.2.5 is Current and a lot of the 
documentation on php.net is showing that it will be implemented in 5.3.0  such 
as namespaces.

Joshua

   
-
Never miss a thing.   Make Yahoo your homepage.

SV: [PHP] Re: Php exec

2007-12-23 Thread mattias
Yes i have looked in that but not understadn anything

-Ursprungligt meddelande-
Från: Christophe Gosiau [mailto:[EMAIL PROTECTED] 
Skickat: den 23 december 2007 23:37
Till: php-general@lists.php.net
Ämne: [PHP] Re: Php exec


Try to configure courier te read his mailboxes/users from mysql?

mattias schreef:
 If i use courier-mta
 Can i create a php script wich create mailboxes?
 And users
 Hope any understand

-- 
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] about __get,__set Overloading, read-only properties

2007-12-23 Thread ked
 I think  you misread my pure-hearted thankfulness.I am sorry for my
ambiguous sentence.   
Last reply mean :  I'm  happy to known that we have the same idea,  just
like a student got teacher's praise .
Merry Christmas Eve!


 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, December 23, 2007 9:08 AM
 To: ked
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] about __get,__set Overloading, read-only properties
 
 ked schreef:
   My idea is just  your answer...happy..ing  ^_^
  
  You are so warmhearted.  Thanks a lot!  : )
 
 I don't get accused of that very often. are you being 
 sarcastic or did my suggestion help? (sorry I didn't quite 
 understand your reply)
 
  
  I will never post a question to a existing thread .
 
 good. that's one down 1,000,983 to go :-)
 
  

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



RE: [PHP] Try{} Catch()

2007-12-23 Thread ked
use it just like in JAVA, It offers a uniform/good way to  manage exception
in app.  
e.g. 
function getObjFromDB($key)
{
if (strlen($key)!=0 )
throw new Exception (need condition .);
if (!mysql_connect(...))
throw new Exception (can't connect to db .);
.
}

function foo ()
{
$err='';
for (...)
{
try
{
getObjFromDB('');
}
catch (Exception $e) // if you throw a exception but didn't catch it , the
PHP app will stop and not prompt any error message.
{
echo $e; //output the error message.
$err .= $e;
} 
}
echo done , total message : {$err};
}
 


 -Original Message-
 From: Al [mailto:[EMAIL PROTECTED] 
 Sent: Monday, December 24, 2007 5:59 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Try{} Catch()
 
 I understand it's intended use and how to use it, have just 
 not found a good use for it yet.
 
 
 
 Martin Alterisio wrote:
  It's not supposed to be practical, it's just a way to 
 handle errors. You
  shouldn't rely on try/catch for algorithm implementation.
  
  You create exceptions for errors and unexpected behavior. 
 Then in some other
  part of the system you use try/catch to prevent the code 
 from terminating
  abruptly. You catch the exception (you should know which 
 exceptions can be
  thrown), and act accordingly. Either closing resources, add 
 a log message
  with debug information, and/or sending an error message to the user.
  
  2007/12/23, Al [EMAIL PROTECTED]:
  Try() and Catch() seems neat; but, I've not found it to be 
 very practical.
 
  Anyone using it? How?
 
  Al...
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] is there have something in php that allows method redispatch?

2007-12-23 Thread Wan Chaowei
hello all,

i'm poor in english and php. i want to kown is there have something in
php that allows method redispatch?

like this
http://search.cpan.org/~dconway/NEXT-0.60/lib/NEXT.pm

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



[PHP] Is there have something in php that allows method redispatch?

2007-12-23 Thread Wan Chaowei
hello all,
i'm poor in php and english,I want to know is there have something in
php that allows method redispatch?

like this
http://search.cpan.org/~dconway/NEXT-0.60/lib/NEXT.pm

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



Re: [PHP] Sending SMS via PHP

2007-12-23 Thread VamVan
Hi Bastien,

I have actually implemented sending SMS using PHP by installing NOW SMS
gateway. You can find all the information regarding it on www.nowsms.com.
They have a software that you can buy and configure on your server.

I wrote scripts that can help sending single SMS, BULK SMS, User Defined SMS
etc. I also configured using PHP in a way to receive  SMS  to the web server
and store it in the database. Its really exciting when you start working on
this because you will be basically using SOAP and SMPP protocol to achieve
this.

Once you install trial Version mail me back so that I can help you with PHP
Scripts that can actually allow you to SEND SMS. 160 characters are allowed
per SMS and you also need connection to the SMS gateway in your country.

Thanks,
Vamsee




On Dec 23, 2007 6:59 AM, Bastien Koert [EMAIL PROTECTED] wrote:


 Sending proper SMS messges requires that you use an SMS gateway or buy a
 cellular modem. SMS is essentially XML will the message body limited to 160
 characters.

 do some googling to get more information

 bastien
 
  Date: Sun, 23 Dec 2007 08:30:29 +0330
  From: [EMAIL PROTECTED]
  To: php-general@lists.php.net
  Subject: [PHP] Sending SMS via PHP
 
  Hi,
 
  How can i send SMS messages via PHP? How can i set SMS-headers (UDH)?
  Does anyone know some article/class/package about this issue?
 
  Thank you in advance,
  -b

 _
 Discover new ways to stay in touch with Windows Live! Visit the City @
 Live today!
 http://getyourliveid.ca/?icid=LIVEIDENCA006
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php