php-general Digest 15 Oct 2010 04:16:02 -0000 Issue 6988

Topics (messages 308695 through 308729):

Buffering output to allow headers late in code?
        308695 by: MikeB
        308696 by: chris h
        308697 by: MikeB
        308698 by: Richard Quadling
        308699 by: Richard Quadling
        308700 by: Peter Lind
        308718 by: MikeB
        308721 by: chris h

Re: floored by floor()
        308701 by: Mattias Thorslund
        308702 by: Glen Fuller
        308703 by: chris h
        308704 by: Mattias Thorslund
        308722 by: Shawn McKenzie

Re: References in Sessions
        308705 by: Alexander Schrijver
        308706 by: Sebastian Detert
        308723 by: Alexander Schrijver

Text messaging from the web
        308707 by: Paul M Foster
        308708 by: Larry Martell
        308709 by: Alexis
        308710 by: Sebastian Detert
        308711 by: Jay Blanchard
        308712 by: chris h
        308713 by: Sebastian Detert
        308714 by: Bastien Koert
        308715 by: Paul M Foster
        308716 by: Larry Martell
        308717 by: Larry Martell
        308719 by: Sebastian Detert
        308720 by: Larry Martell

RegExp question: how to add a number?
        308724 by: Andre Polykanine
        308727 by: David Harkness
        308728 by: Richard Quadling

Help with sending credentials?
        308725 by: Brian Dunning
        308726 by: Adam Richardson

Re: searching for application like Google Doc
        308729 by: Sharl.Jimh.Tsin

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


----------------------------------------------------------------------
--- Begin Message --- I'm working through my class on PHP and I tried to put information from my sign-on process in the navbar. This didn't work well, since I had to reload the page to see it as the navbar was constructed earlier in the code than the signon process. (Hard to explain, as we are building a "dynamic" web page with lots of include files to fill in the main contnt portion of the page.)

My instructor suggested that I do the reload of the page via php

header("Location: index.php");

after the sign-in. To do this, I have to turn on output buffering.

I recall struggling to turn off output buffering since someone here recommended against it.

Any thoughts on this? Is this just a "quick and dirty" bypass for my problem, accepted practice, a really bad idea, or customary practice?

I think I can code around this with some effort by putting a switch statement in the header of the index.php, but that may be clumsy as parts of the same web page will then be processed in two different areas.

What to do?

Thanks for any advice.


--- End Message ---
--- Begin Message ---
>
>
> I'm working through my class on PHP and I tried to put information from my
> sign-on process in the navbar. This didn't work well, since I had to reload
> the page to see it as the navbar was constructed earlier in the code than
> the signon process. (Hard to explain, as we are building a "dynamic" web
> page with lots of include files to fill in the main contnt portion of the
> page.)
>
>
I don't know if this will be much help, but I try to do all the controller /
model work before I mess with the view side.  So the controller starts off
with the ball, then he and the model pass it between each other a few times
until the controller finally hands it over to the view, who does her magic
and makes the score! ... Perhaps that analogy went to far.

At any rate!  Ideally the sign-on task would be done before any tasks that
would use sign-on data. Additionally, the layout of your page should
not necessarily dictate the order of any tasks (i.e. the sign-on box being
below the welcome box should not mean that the sign-on task gets done before
the welcome task).


Hope that helps!
Chris.

--- End Message ---
--- Begin Message ---
chris h wrote:


I'm working through my class on PHP and I tried to put information from my
sign-on process in the navbar. This didn't work well, since I had to reload
the page to see it as the navbar was constructed earlier in the code than
the signon process. (Hard to explain, as we are building a "dynamic" web
page with lots of include files to fill in the main contnt portion of the
page.)


I don't know if this will be much help, but I try to do all the controller /
model work before I mess with the view side.  So the controller starts off
with the ball, then he and the model pass it between each other a few times
until the controller finally hands it over to the view, who does her magic
and makes the score! ... Perhaps that analogy went to far.

At any rate!  Ideally the sign-on task would be done before any tasks that
would use sign-on data. Additionally, the layout of your page should
not necessarily dictate the order of any tasks (i.e. the sign-on box being
below the welcome box should not mean that the sign-on task gets done before
the welcome task).


Hope that helps!
Chris.


I guess that is kind of how I was thinking I might have to rewrite the code - but that seems to be a major departure from the current "architecture" of the website we're developing in the course and I'm kind of worried that it might get harder and harder to follow along in the lessons if I deviate too much.


--- End Message ---
--- Begin Message ---
On 14 October 2010 15:01, MikeB <mpbr...@gmail.com> wrote:
> chris h wrote:
>>>
>>>
>>> I'm working through my class on PHP and I tried to put information from
>>> my
>>> sign-on process in the navbar. This didn't work well, since I had to
>>> reload
>>> the page to see it as the navbar was constructed earlier in the code than
>>> the signon process. (Hard to explain, as we are building a "dynamic" web
>>> page with lots of include files to fill in the main contnt portion of the
>>> page.)
>>>
>>>
>> I don't know if this will be much help, but I try to do all the controller
>> /
>> model work before I mess with the view side.  So the controller starts off
>> with the ball, then he and the model pass it between each other a few
>> times
>> until the controller finally hands it over to the view, who does her magic
>> and makes the score! ... Perhaps that analogy went to far.
>>
>> At any rate!  Ideally the sign-on task would be done before any tasks that
>> would use sign-on data. Additionally, the layout of your page should
>> not necessarily dictate the order of any tasks (i.e. the sign-on box being
>> below the welcome box should not mean that the sign-on task gets done
>> before
>> the welcome task).
>>
>>
>> Hope that helps!
>> Chris.
>>
>
> I guess that is kind of how I was thinking I might have to rewrite the code
> - but that seems to be a major departure from the current "architecture" of
> the website we're developing in the course and I'm kind of worried that it
> might get harder and harder to follow along in the lessons if I deviate too
> much.

If your code is being developed along the lines of ...

<html tag><?php logic /><html tag><?php more php logic /><another html tag>

then that is _PROBABLY_ of for a small one of script or a very very
small amount of code.

But for most long term development, this isn't a nice way to work.

Many developers don't like mixing things up.

A mechanism I employ that helped me when I started working with PHP is
to only have 1 echo statement in the entire page.

That way, headers, cookies, etc. can all take place as they need to
but only at the end of the script is the content released to the
client.

In effect, I was doing my own output buffering.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
On 14 October 2010 15:09, Richard Quadling <rquadl...@gmail.com> wrote:
> then that is _PROBABLY_ of for a small one of script or a very very

"... _PROBABLY_ ok ..."

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
Just out of curiosity: why were you told to switch off output buffering?

Regards
Peter

-- 
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>

--- End Message ---
--- Begin Message ---
Peter Lind wrote:
Just out of curiosity: why were you told to switch off output buffering?

Regards
Peter


I can't find the thread now, but it was in regards to my early experiments with cookies. I was creating cookies and it worked mid-code, since buffering was active.

Then someone said that using buffering was a bad idea and I should disable it.



--- End Message ---
--- Begin Message ---
>
>
> Then someone said that using buffering was a bad idea and I should disable
> it.
>
>
I think it leads to poor habits like calling controller methods out of the
view (essentially what you are wanting to use it for). Using it like that is
asking for spaghetti code that's hard to maintain, scale, and train new
developers on.  I'd imagine it also adds overhead, though I don't know how
much - my guess is negligible.

OB can be a great tool, but it shouldn't be a hack to get around sloppy
architecture.

Just my 2 cents :)
Chris.

--- End Message ---
--- Begin Message ---
On 10/13/2010 11:56 PM, gaojian wrote:
在 2010-10-13三的 22:48 -0700,Mattias Thorslund写道:
Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias


i think u should read the manual about int and float:

http://www.php.net/manual/en/language.types.integer.php

http://www.php.net/manual/en/language.types.float.php#warn.float-precision


jim

Thanks, I guess I needed to read that again. What confused me here was that var_dump(327.03 * 100) returns the expected value and not something like (float)32702.99999999999999...

Cheers,

Mattias


--- End Message ---
--- Begin Message ---
On 10/13/2010 10:48 PM, Mattias Thorslund wrote:
Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias



Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest integer to 32703 it returns it?

Glen Fuller


--- End Message ---
--- Begin Message ---
floor(32703) is different then floor(327.03 * 100).  The former is an int,
while the later is a float.  Read those links that were sent :)


Chris.


On Thu, Oct 14, 2010 at 2:14 AM, Glen Fuller <glenmful...@shaw.ca> wrote:

> On 10/13/2010 10:48 PM, Mattias Thorslund wrote:
>
>> Hi List,
>>
>> I'm having a problem with the behavior of the floor() function:
>>
>> echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!
>>
>> Sanity check:
>> var_dump(327.03 * 100); //prints "float(32703)" as expected
>>
>> Any ideas why this happens, and how to work around it?
>>
>> Thanks,
>>
>> Mattias
>>
>>
>>
> Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest
> integer to 32703 it returns it?
>
> Glen Fuller
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 10/13/2010 11:14 PM, Glen Fuller wrote:
On 10/13/2010 10:48 PM, Mattias Thorslund wrote:
Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias



Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest integer to 32703 it returns it?

Glen Fuller

Nope, this is floating-point math fuzziness. Try it:

echo floor(32703)."\n";
echo floor(327.03 * 100)."\n";

Cheers,

Mattias

--- End Message ---
--- Begin Message ---
On 10/14/2010 09:22 AM, Mattias Thorslund wrote:
> Thanks, I guess I needed to read that again. What confused me here was
> that var_dump(327.03 * 100) returns the expected value and not something
> like (float)32702.99999999999999...
> 
> Cheers,
> 
> Mattias
> 

echo serialize(327.03 * 100);

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Is my message unclear? or didn't anyone  ran into this problem?

--- End Message ---
--- Begin Message ---
Alexander Schrijver schrieb:
Is my message unclear? or didn't anyone  ran into this problem?

If you want an atomic solution, you need to save the session to your database. How often do you need to delete data? Isn't it better to delete at night when noone is online, or logout all users for some minutes while deleting? In addition to that I don't understand, why it is important to prevent deletion if a point is selected ... If you want to work with something that was deleted, print an error and that's it.
--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 05:36:29PM +0200, Sebastian Detert wrote:
> Alexander Schrijver schrieb:
> >Is my message unclear? or didn't anyone  ran into this problem?
> >
> If you want an atomic solution, you need to save the session to your
> database. How often do you need to delete data? Isn't it better to
> delete at night when noone is online, or logout all users for some
> minutes while deleting? In addition to that I don't understand, why
> it is important to prevent deletion if a point is selected ... If
> you want to work with something that was deleted, print an error and
> that's it.

Yes, i can use a database. But i can't properly use the SESSION abstraction
with a database.

suppose i build a Session handler which writes to the database it needs to
write to specific tables which contain the proper constraints.

e.g. 

table session
        session_id (PK)

table companies
        company_id (PK)
        session_id -> session(session_id)

i.e. (one to many relationship)

Thus $_SESSION['companies'] = Array(1,2,3) needs to be translated to insert a
row in the companies table.

Now suppose someone does $_SESSION['somethingwhichdoesnexist'] = 'bladiebla'
(which is invalid) i can't make it properly fail. Because the Session handler
is run at a later point.

I can't find a method to properly work around this without rewriting to whole
session handler.

Doing deletions at night isn't solving the problem. Users can exist at night.

Printing an error isn't solving the problem either. What kind of message should
i print? "Something went wrong; i am not entirely sure what but it probably the
administrator deleted or changed a the database. Oh, and your session is now
useless".

This seemed like an obvious problem to me with an obvious solution which i
missed. Nobody has this problem?


--- End Message ---
--- Begin Message ---
Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com> wrote:
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?

You can send a text message via email:

    Verizon: 10digitphonenum...@vtext.com
    AT&T: 10digitphonenum...@txt.att.net
    Sprint: 10digitphonenum...@messaging.sprintpcs.com
    T-Mobile: 10digitphonenum...@tmomail.net
    Nextel: 10digitphonenum...@messaging.nextel.com
    Cingular: 10digitphonenum...@cingularme.com
    Virgin Mobile: 10digitphonenum...@vmobl.com
    Alltel: 10digitphonenum...@message.alltel.com
    CellularOne: 10digitphonenum...@mobile.celloneusa.com
    Omnipoint: 10digitphonenum...@omnipointpcs.com
    Qwest: 10digitphonenum...@qwestmp.com

--- End Message ---
--- Begin Message ---
iT DEPENDS on which country you are in.

In Canada you can send a text message to any mobile phone simply by sending an email to the phone number followed by the service provider's details...eg 1234567...@telus.net
Details for the exact addresses each provider use, can be found on the net.

In England there were free providers a few years ago, but I believe now you have to pay for the service.

Alexis

On 14/10/10 09:45, Paul M Foster wrote:
Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul


--- End Message ---
--- Begin Message ---
Paul M Foster schrieb:
Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul

I guess you have to connect to any kind of interface of a commercial provider. I searched for "php sms" on google and got several tutorials and informations. Just give it a try.

Sebastian

--- End Message ---
--- Begin Message ---
[snip]
Being fairly geezerly, I know almost nothing about this, so be gentle.
[/snip]

Rubber gloves first....

[snip]
text messaging gateway?
[/snip]

It is fairly simple and we offer that from one of our sites (because it
is a cell phone service provider). In this case we use PHP to send the
information to the SMS gateway that the provider owns. It is a one way
operation - send only, no receive. You'd have to get into near-real time
CDR's etc - for receiving and it isn't worth it.

All of the commercial gateways that I am familiar with offer API's that
are simple and easy to implement. 

--- End Message ---
--- Begin Message ---
>
> You can send a text message via email:
>
>    Verizon: 10digitphonenum...@vtext.com
>    AT&T: 10digitphonenum...@txt.att.net
>    Sprint: 10digitphonenum...@messaging.sprintpcs.com
>    T-Mobile: 10digitphonenum...@tmomail.net
>    Nextel: 10digitphonenum...@messaging.nextel.com
>    Cingular: 10digitphonenum...@cingularme.com
>    Virgin Mobile: 10digitphonenum...@vmobl.com
>    Alltel: 10digitphonenum...@message.alltel.com
>    CellularOne: 10digitphonenum...@mobile.celloneusa.com
>    Omnipoint: 10digitphonenum...@omnipointpcs.com
>    Qwest: 10digitphonenum...@qwestmp.com
>
>
Larry, it seems like this method would only be useful if you knew the
carrier of a specific number.  Do you know of a way to determine that?


Chris.

--- End Message ---
--- Begin Message ---
Larry Martell schrieb:
On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com> wrote:
Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

You can send a text message via email:

    Verizon: 10digitphonenum...@vtext.com
    AT&T: 10digitphonenum...@txt.att.net
    Sprint: 10digitphonenum...@messaging.sprintpcs.com
    T-Mobile: 10digitphonenum...@tmomail.net
    Nextel: 10digitphonenum...@messaging.nextel.com
    Cingular: 10digitphonenum...@cingularme.com
    Virgin Mobile: 10digitphonenum...@vmobl.com
    Alltel: 10digitphonenum...@message.alltel.com
    CellularOne: 10digitphonenum...@mobile.celloneusa.com
    Omnipoint: 10digitphonenum...@omnipointpcs.com
    Qwest: 10digitphonenum...@qwestmp.com

Me again ;) Is that for free? I just found this interesting site: http://www.tech-faq.com/how-to-send-text-messages-free.html
--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 11:50 AM, Larry Martell
<la...@software-horizons.com> wrote:
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com> 
> wrote:
>> Folks:
>>
>> Being fairly geezerly, I know almost nothing about this, so be gentle.
>>
>> Assuming someone entered information in a form on a website. Normally,
>> you would email the responses to someone. But what if you wanted to
>> send this information to a smartphone via text messaging?
>>
>> Is this possible, given normal programming tools (PHP/Javascript), or
>> would you have to go through some commercial web to text messaging
>> gateway? Does anyone know if this could be done, and how?
>
> You can send a text message via email:
>
>    Verizon: 10digitphonenum...@vtext.com
>    AT&T: 10digitphonenum...@txt.att.net
>    Sprint: 10digitphonenum...@messaging.sprintpcs.com
>    T-Mobile: 10digitphonenum...@tmomail.net
>    Nextel: 10digitphonenum...@messaging.nextel.com
>    Cingular: 10digitphonenum...@cingularme.com
>    Virgin Mobile: 10digitphonenum...@vmobl.com
>    Alltel: 10digitphonenum...@message.alltel.com
>    CellularOne: 10digitphonenum...@mobile.celloneusa.com
>    Omnipoint: 10digitphonenum...@omnipointpcs.com
>    Qwest: 10digitphonenum...@qwestmp.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Actually email doesn't work reliably with all providers. I was looking
into this for a client project. The main issue is that some providers
require the user to have a data plan since the message will arrive as
email, as opposed to text. The other is that if there is enough
traffic from your site, it may become marked as spam and future
connections will be refused.

The best is to hook up with an SMS provider who can provide the
services at a reasonable cost (cell-trust or click-a-tell) and let
them manage the SMS portion. You then need to code against their
service, which is usually pretty easy

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 11:56:20AM -0400, chris h wrote:

>      You can send a text message via email:
>      � �Verizon: [1]10digitphonenum...@vtext.com
>      � �AT&T: [2]10digitphonenum...@txt.att.net
>      � �Sprint: [3]10digitphonenum...@messaging.sprintpcs.com
>      � �T-Mobile: [4]10digitphonenum...@tmomail.net
>      � �Nextel: [5]10digitphonenum...@messaging.nextel.com
>      � �Cingular: [6]10digitphonenum...@cingularme.com
>      � �Virgin Mobile: [7]10digitphonenum...@vmobl.com
>      � �Alltel: [8]10digitphonenum...@message.alltel.com
>      � �CellularOne: [9]10digitphonenum...@mobile.celloneusa.com
>      � �Omnipoint: [10]10digitphonenum...@omnipointpcs.com
>      � �Qwest: [11]10digitphonenum...@qwestmp.com
> 
>    Larry, it seems like this method would only be useful if you knew the
>    carrier of a specific number. �Do you know of a way to determine that?
>    Chris.

Normally, you'd know who you were sending the form email to, and I would
assume you can find out their cell phone provider as well.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 9:56 AM, chris h <chris...@gmail.com> wrote:
>> You can send a text message via email:
>>    Verizon: 10digitphonenum...@vtext.com
>>    AT&T: 10digitphonenum...@txt.att.net
>>    Sprint: 10digitphonenum...@messaging.sprintpcs.com
>>    T-Mobile: 10digitphonenum...@tmomail.net
>>    Nextel: 10digitphonenum...@messaging.nextel.com
>>    Cingular: 10digitphonenum...@cingularme.com
>>    Virgin Mobile: 10digitphonenum...@vmobl.com
>>    Alltel: 10digitphonenum...@message.alltel.com
>>    CellularOne: 10digitphonenum...@mobile.celloneusa.com
>>    Omnipoint: 10digitphonenum...@omnipointpcs.com
>>    Qwest: 10digitphonenum...@qwestmp.com
>>
>
> Larry, it seems like this method would only be useful if you knew the
> carrier of a specific number.  Do you know of a way to determine that?

http://www.fonefinder.net/

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
<php-maill...@elygor.de> wrote:
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com>
> wrote:
>
>
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?
>
>
> You can send a text message via email:
>
>     Verizon: 10digitphonenum...@vtext.com
>     AT&T: 10digitphonenum...@txt.att.net
>     Sprint: 10digitphonenum...@messaging.sprintpcs.com
>     T-Mobile: 10digitphonenum...@tmomail.net
>     Nextel: 10digitphonenum...@messaging.nextel.com
>     Cingular: 10digitphonenum...@cingularme.com
>     Virgin Mobile: 10digitphonenum...@vmobl.com
>     Alltel: 10digitphonenum...@message.alltel.com
>     CellularOne: 10digitphonenum...@mobile.celloneusa.com
>     Omnipoint: 10digitphonenum...@omnipointpcs.com
>     Qwest: 10digitphonenum...@qwestmp.com
>
>
>
> Me again ;) Is that for free? I just found this interesting site:
> http://www.tech-faq.com/how-to-send-text-messages-free.html

Yes, you can send text messages for free this way.

--- End Message ---
--- Begin Message ---
Larry Martell schrieb:
On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
<php-maill...@elygor.de> wrote:
Larry Martell schrieb:

On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com>
wrote:


Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?


You can send a text message via email:

    Verizon: 10digitphonenum...@vtext.com
    AT&T: 10digitphonenum...@txt.att.net
    Sprint: 10digitphonenum...@messaging.sprintpcs.com
    T-Mobile: 10digitphonenum...@tmomail.net
    Nextel: 10digitphonenum...@messaging.nextel.com
    Cingular: 10digitphonenum...@cingularme.com
    Virgin Mobile: 10digitphonenum...@vmobl.com
    Alltel: 10digitphonenum...@message.alltel.com
    CellularOne: 10digitphonenum...@mobile.celloneusa.com
    Omnipoint: 10digitphonenum...@omnipointpcs.com
    Qwest: 10digitphonenum...@qwestmp.com



Me again ;) Is that for free? I just found this interesting site:
http://www.tech-faq.com/how-to-send-text-messages-free.html

Yes, you can send text messages for free this way.

I just tried it. I guess, it is only possible to use those E-Mails if you are a customer of that phone company, right? I tried it with my own provider (O2 germany), sending an email to phonenum...@o2online.de failed, I had to activate that serviceby sending +OPEN to 6245, but every email to sms costs money ... Are you sure it is possible to send sms to phones around the world to any provider? How do u distinguish between provider and country?

I'm sorry if I'm asking stupid stuff

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 10:29 AM, Sebastian Detert
<php-maill...@elygor.de> wrote:
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
> <php-maill...@elygor.de> wrote:
>
>
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster <pa...@quillandmouse.com>
> wrote:
>
>
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?
>
>
> You can send a text message via email:
>
>     Verizon: 10digitphonenum...@vtext.com
>     AT&T: 10digitphonenum...@txt.att.net
>     Sprint: 10digitphonenum...@messaging.sprintpcs.com
>     T-Mobile: 10digitphonenum...@tmomail.net
>     Nextel: 10digitphonenum...@messaging.nextel.com
>     Cingular: 10digitphonenum...@cingularme.com
>     Virgin Mobile: 10digitphonenum...@vmobl.com
>     Alltel: 10digitphonenum...@message.alltel.com
>     CellularOne: 10digitphonenum...@mobile.celloneusa.com
>     Omnipoint: 10digitphonenum...@omnipointpcs.com
>     Qwest: 10digitphonenum...@qwestmp.com
>
>
>
> Me again ;) Is that for free? I just found this interesting site:
> http://www.tech-faq.com/how-to-send-text-messages-free.html
>
>
> Yes, you can send text messages for free this way.
>
>
>
> I just tried it. I guess, it is only possible to use those E-Mails if you
> are a customer of that phone company, right? I tried it with my own provider
> (O2 germany),
> sending an email to phonenum...@o2online.de failed, I had to activate that
> serviceby sending +OPEN to 6245, but every email to sms costs money ...
> Are you sure it is possible to send sms to phones around the world to any
> provider? How do u distinguish between provider and country?
>
> I'm sorry if I'm asking stupid stuff

I have no idea how it works in other countries or with every single
provider. I do know that here in the US I do it all the time with the
carriers I listed above. I have cron based monitors that text people
via email when there are problems.

--- End Message ---
--- Begin Message ---
Hi everyone,
I hope you're doing well (haven't written here for a long time :-)).
The question is as follows: I have a regexp that would do the
following. If the string begins with "Re:", it will change the
beginning to "Re[2]:"; if it doesn't, then it would add "Re:" at the
beginning. But (attention, here it is!) if the string starts with
something like "Re[4]:", it should replace it by "Re[5]:".
Here's the code:

$start=mb_strtolower(mb_substr($f['Subject'], 0, 3));
if ($start=="re:") {
$subject=preg_replace("/^re:(.+?)$/usi", "re[2]:$1", $f['Subject']);
} elseif ($start=="re[") {
// Here $1+1 doesn't work, it returns "Re[4+1]:"!
$subject=preg_replace("/^re\[(\d+)\]:(.+?)$/usi", "re[$1+1]:$2", $f['Subject']);
} else {
$subject="Re: ".$f['Subject'];
}

I know there actually exists a way to do the numeral addition
("Re[5]:", not "Re[4+1]:").
How do I manage to do this?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 1:42 PM, Andre Polykanine <an...@oire.org> wrote:

> But (attention, here it is!) if the string starts with
> something like "Re[4]:", it should replace it by "Re[5]:".
>

Regular expressions do not support any mathematical operations. Instead, you
need to use preg_match() to extract the number inside the brackets,
increment it, and build a new string using simple concatenation (.).

    elseif ($start=="re[") {
        if (preg_match('/^re\[(\d+)\](.*)/i', $f['Subject'], $matches) > 0)
{
            $f['Subject'] = 'Re[' . ($matches[1] + 1) . ']' . $matches[2];
        }
        else {
            // no closing brace -- now what?
        }
    }

David

--- End Message ---
--- Begin Message ---
On 14 October 2010 21:42, Andre Polykanine <an...@oire.org> wrote:
> Hi everyone,
> I hope you're doing well (haven't written here for a long time :-)).
> The question is as follows: I have a regexp that would do the
> following. If the string begins with "Re:", it will change the
> beginning to "Re[2]:"; if it doesn't, then it would add "Re:" at the
> beginning. But (attention, here it is!) if the string starts with
> something like "Re[4]:", it should replace it by "Re[5]:".
> Here's the code:
>
> $start=mb_strtolower(mb_substr($f['Subject'], 0, 3));
> if ($start=="re:") {
> $subject=preg_replace("/^re:(.+?)$/usi", "re[2]:$1", $f['Subject']);
> } elseif ($start=="re[") {
> // Here $1+1 doesn't work, it returns "Re[4+1]:"!
> $subject=preg_replace("/^re\[(\d+)\]:(.+?)$/usi", "re[$1+1]:$2", 
> $f['Subject']);
> } else {
> $subject="Re: ".$f['Subject'];
> }
>
> I know there actually exists a way to do the numeral addition
> ("Re[5]:", not "Re[4+1]:").
> How do I manage to do this?
> Thanks!

Can you adapt this ...

<?php
$s_Text = 'Re: A dummy subject.';

foreach(range(1,10) as $i_Test)
        {
        echo $s_Text = preg_replace_callback
                (
                '`^Re(\[(\d++)\])?:`',
                function($a_Match)
                        {
                        if (count($a_Match) == 1)
                                {
                                $i_Count = 2;
                                }
                        else
                                {
                                $i_Count = 1 + $a_Match[2];
                                }
                        return "Re[$i_Count]:";
                        },
                $s_Text
                ), PHP_EOL;
        }


Outputs ...

Re[2]: A dummy subject.
Re[3]: A dummy subject.
Re[4]: A dummy subject.
Re[5]: A dummy subject.
Re[6]: A dummy subject.
Re[7]: A dummy subject.
Re[8]: A dummy subject.
Re[9]: A dummy subject.
Re[10]: A dummy subject.
Re[11]: A dummy subject.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
Gents -

I'm trying to work with a major vendor's web service, but all my efforts are 
met with a 401 authentication error response. I can log in manually to this URL 
using these credentials through a browser, so I know the credentials are good. 
Unfortunately the support guys at the vendor don't see any problem with my code 
and have not been able to help.

$url = "https://servername.com/script";;
$ctx = stream_context_create(array('https' => array(
        'timeout' => 10,
        'header'  => sprintf("Authorization: Basic %s\r\n", 
base64_encode("myUsername:myPassword"))
        )));
$result = file_get_contents($url, 0, $ctx);     
$http_response = explode(' ', $http_response_header[0]);
$response_code = $http_response[1];     <<<=== This is evaluating to '401'


Thanks.

--- End Message ---
--- Begin Message ---
On Thu, Oct 14, 2010 at 4:45 PM, Brian Dunning <br...@briandunning.com>wrote:

> Gents -
>
> I'm trying to work with a major vendor's web service, but all my efforts
> are met with a 401 authentication error response. I can log in manually to
> this URL using these credentials through a browser, so I know the
> credentials are good. Unfortunately the support guys at the vendor don't see
> any problem with my code and have not been able to help.
>
> $url = "https://servername.com/script";;
> $ctx = stream_context_create(array('https' => array(
>        'timeout' => 10,
>        'header'  => sprintf("Authorization: Basic %s\r\n",
> base64_encode("myUsername:myPassword"))
>        )));
> $result = file_get_contents($url, 0, $ctx);
> $http_response = explode(' ', $http_response_header[0]);
> $response_code = $http_response[1];     <<<=== This is evaluating to '401'
>
>
> Thanks.
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Could the method (POST vs GET) or the content type be causing the issue
(hard to guess beyond this without knowing the service?)  See this simple
twitter function for examples of what I'm wondering about:
http://fabien.potencier.org/article/20/tweeting-from-php

Adam

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

--- End Message ---
--- Begin Message ---
Are you looking for a open-source project likes it?

searching it via Google with "php"、"office doc"、"open source" key
words may help you.

Best regards,
Sharl.Jimh.Tsin (From China)



2010/10/14 Bob McConnell <r...@cbord.com>:
> From: ??
>
>> Is there any application like Google Doc(here I mean the spreadsheet).
>
> What is your conception of "like"?
>
> Have you looked at OpenOffice?
>
> Bob McConnell
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---

Reply via email to