URL -> stream context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So I've been poring over the docs for the new stream stuff, and it
looks pretty nifty, except...

I'd really like to be able to just hand a URL to PHP like:
http://php.net/manual/en/ref.stream.php

And let PHP figure out how to create a stream context out of that, and
which port to use, and how to do the GET to start things off, so I can
just read my data.

In other words, I'm greedy, and I want *BOTH* the simplicity of
fopen() *and* the flexiblity of adding filters and all the fun new
stuff.

I don't want to have to tear apart the URL myself and mess with
sending 'GET ...' and 'host: ...'

Did I miss a stream_url_to_context() function somewhere?...

Not just parse_url() -- That will tear apart the URL, but then I have
to do all the work that's buried in fopen()

Bigger Picture:
I have an old class that will take an array of HTTP URLs, and
fsockopen them, set them non-blocking, and then fread() each in turn,
and gather an array of results.

The class has a 'timeout' parameter that limits how long it will wait
for all this to happen.

Each result set is marked as complete or incomplete.

Complete results may be cached, for however long you choose in another
setting.

If results are incomplete, the cached version is used, no matter how
obsolete.  (This is for a search engine.)

Blah, blah, blah.

Anyway, I'd *LIKE* to be able to just allow *ANY* URL to be passed in,
and have some nifty stream function, not unlike fopen(), that will
take care of the grotty details of doing whatever it takes to get the
data, but let me set the socket non-blocking and read them
asynchronously.

I feel like I must be missing something fundamentally simple here in
all this stream stuff, but it's sure not obvious what I'm missing in
the docs.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux