|
Posted by Jerry Stuckle on 01/19/08 01:46
Manuel Lemos wrote:
> Hello,
>
> on 01/17/2008 10:15 PM Jerry Stuckle said the following:
>>> Does anybody have some idea how to input some text into inputbox on
>>> one page, than press some button on that page, that will load another
>>> page, and finally read the responde? Suppose I want to write a price
>>> comparision engine, where I would like to parse shops website for
>>> price each time user wants.
>>>
>>> I have found similar feature in Symfony framework, called sfBrowser
>>> (or sfTestBrowser). These are made for automated functional testing,
>>> but should provide the functinality I am requesting.
>>>
>>> The question is: will this be efficient enough? Maybe there are other
>>> ways to achieve this? Of course I can always try to make it more
>>> manually - look for some pattern in url (search is usually done via
>>> GET), and parse output html.
>>>
>>> Thanks for help
>>> Marcin
>>>
>> cURL will allow you to get or post to pages, and will return the data. I
>> much prefer it over the HTTPClient class. It's more flexible.
>
> I wonder which HTTP client you are talking about. The HTTP client I
> mentioned wraps around Curl or socket functions depending on which is
> more convinient to use in each PHP setup. This is the HTTP client class
> I meant:
>
> http://www.phpclasses.org/httpclient
>
The same one.
> As for Curl being flexible, I wonder what you are talking about.
>
I can do virtually anything with it that I can do with a browser, with
the exception of client side scripting. Also much less overhead than
the httpclient class.
> Personally I find it very odd that you cannot read retrieved pages with
> Curl in small chunks at a time without having to use callbacks. This is
> bad because it makes very difficult to retrieve and process large pages
> without using external files nor exceeding the PHP memory limits.
>
So? I never needed to. First of all, I have no need to retrieve huge
pages. The larges I've ever downloaded (a table with lots of info) was
a little over 3MB and Curl and PHP handled it just fine.
But if the text were split, you need to do additional processing to
handle splits at inconvenient locations. Much easier to add everything
to a temporary file and read it back in the way I need to so it.
But that's one of the advantages of cURL - it gives me the option of
doing the callbacks or not.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|