You are here: Re: Streams and wrappers « PHP Programming Language « IT news, forums, messages
Re: Streams and wrappers

Posted by shimmyshack on 06/26/07 11:17

On Jun 26, 11:02 am, Julien Biezemans <jb@jb> wrote:
> shimmyshack wrote:
> > On Jun 26, 8:34 am, Julien Biezemans <jb@jb> wrote:
> >> shimmyshack wrote:
>
> >>> you can also use a wrapper around stream_wrapper_register()!! hee hee
> >>> in the end, the usefulness of this kind of statement is surely pretty
> >>> small - well my imagination is limited I suppose, can it really be
> >>> called a "stream protocol"?
> >>> fopen('mailto:u...@domain.com', 'w');
> >>> stream_wrapper_register_even_the_fake_ones( $p, $m='r' )
> >>> {
> >>> //if first 7 chars are 'mailto',
> >>> //{ replace
> >>> //mailto: with mailto:// and do it
> >>> //stream_wrapper_register(str_replace('mailto:','mailto://',$p, $r);
> >>> //}
> >>> }
> >>> etc blah.
> >>> stream_wrapper_register_even_the_fake_ones( 'mailto:b...@blah.com',
> >>> 'w' );
> >>> if you come up with a class that codes for the entire mailto thing
> >>> with imap support and so on please send it along, it would be useful I
> >>> guess
> >> Thank you for your reply but I'm not quite sure I understand your idea
> >> and my guess is that you mixed up stream_wrapper_register() and fopen()
> >> functionality.
>
> >> When I read
>
> >> stream_wrapper_register_even_the_fake_ones( 'mailto:b...@blah.com',
> >> 'w' );
>
> >> I think you meant
>
> >> fopen('mailto:b...@blah.com', 'w');
>
> >> Right?
>
> >> I don't see how a wrapper around stream_wrapper_register() will help
> >> because what is important is the scheme being actually registered and
> >> the str_replace() trick still register "mailto://" and not "mailto:",
> >> from PHP internals point of view.
>
> >> Cheers,
>
> >> Julien.
>
> > I was just questioning what it would /mean/ to register mailto: rather
> > than mailto:// - its just symantics, the work around is needed because
> > mailto isn't really like http://
> > fopen with allow_url_fopen set to true acting on http produces a
> > stream,
> > mailto: has always been just a device for passing local variables to a
> > local program.
> > mailto doesnt have the sam in built status and usefulness as a stream
> > protocol, you would have to work hard to create this functionality,
> > whereas at the moment, we would simple gather variables and pass them
> > to a mail() call, where mail() would wrap an smtp/local mta.
> > I suppose I just don't see the requirement to add functionality to
> > mailto: server side, where it is essentially a client side "hint" for
> > convenience written as a fake protocol.
> > The next question is what does the javascript: "protocol" mean and
> > how to implement that. You could do it, usefulness?
>
> The thing is I used mailto: as an example but I'm actually interested in
> URNs as I explained in the first post. The point of using URNs is
> obvious - at least to me - within XML documents, etc.
>
> I think URNs fall into what the stream wrappers were designed to within
> PHP, unfortunatly their syntax is not that compatible with PHP streams.

I can see your point there, it would be lovely to parse a markup
stream, extract all links and treat them as URNs, and php does have
some way to go in many areas, I'm just waiting for php6 so that
unicode arrives along with other useful bits and pieces!!
In the real world of href="javascript:call();" and so on, is that
people will use just about anything that works for them, and then ftp
up to their space, regardless of the rights and wrongs.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация