[Tfug] php/curl question
Robert Hunter
hunter at tfug.org
Thu Oct 11 09:52:34 MST 2007
On 10/10/07, James Hood <ebenblues at yahoo.com> wrote:
> I do option 1, the output file written contains the entire html output
> as I would expect. But when I do option 2, the DOM object only contains
> the first couple hundred bytes of the html output. From this behavior,
> I'm guessing maybe curl_exec spawns an async thread to complete the http
> request and then the php script continues to run while curl's running
> in the background. This is not the behavior.
No php expert here, but... just from common sense, if curl was running
asynchronously, then you would need to provide it a call-back or use some
other kind of synchronization mechanism to know when it was complete with
the operation. Therefore, I'm inclined to think that is not the case.
To begin with, you may want to check the return value of curl_exec, to
see if there were any errors. Also, for debugging purposes, print out
the content $html before you attempt to parse it with DOM.
--
Rob
More information about the tfug
mailing list