12-04-2007, 12:46 AM
|
#11 (permalink)
|
|
The Contributor
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
|
Here's a little snippet that usually explains an easy way to suck remote data rather easily.
PHP Code:
<?php
$ch = curl_init("http://www.mywebserver.com/path/to/file");
// give it a fake uer agent curl_setopt($ch,CURLOPT_USERAGENT,"Interweb Explorer");
// start the buff ob_start();
curl_exec($ch); curl_close($ch);
$my_output = ob_get_contents();
ob_end_clean;
?>
Also note, that the ob_ function set can be used to make your web pages appear faster on certain browsers.
For example, if you start ob_start(), and beging flushing out the header and body as it comes, the body won't have to wait for certain block level objects like <TABLE> tags to load fully before they start to show up.
Just a little trick you can apply every now and then..
--
Note: was just using the simple curl and ob_ functions to show what they can do together, it's in no way a complete snippet (though it does work).
Last edited by dschreck : 12-04-2007 at 12:48 AM.
Reason: added a note.
|
|
|
|