function get_file($url) {
if (substr($url, 0, 7) == 'http://' && extension_loaded('curl')) {
$gch = curl_init();
curl_setopt ($gch, CURLOPT_URL, $url);
curl_setopt ($gch, CURLOPT_HEADER, 0);
curl_setopt ($gch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($gch, CURLOPT_TIMEOUT, 10);
curl_setopt ($gch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($gch, CURLOPT_REFERER, $url);
curl_setopt ($gch, CURLOPT_USERAGENT, $this->useragent);
$data = "" ($gch);
curl_close ($gch);
} else {
if ($fp = fopen($url, 'r')) {
stream_set_blocking($fp, false);
stream_set_timeout($fp, 10);
$status = socket_get_status($fp);
$data = '';
while (!feof($fp) && !$status['timed_out']) {
$data .= fread($fp, 2048);
$status = socket_get_status($fp);
}
if ($status['timed_out'])
return false;
fclose($fp);
} else return false;
}
return $data;
}
On 4/30/06, Olivier percebois-Garve <[EMAIL PROTECTED]> wrote:
Very interested by your question. Could you detail how you got it working ?
(In fact this cURL thing is completely new to me)
olivvv
Armando Sosa wrote:Thank you. The cURL approach seems to be working.
On 4/30/06, AD7six < [EMAIL PROTECTED]> wrote:
How about:
1) create a controller and view to take care of the content to be
displayed
2) Making a call like:
$latestPortoflios = file_get_contents(CAKE_URL."bare/path/to/render")
To get the content in a string
3) Put the variable where you want the content.
Hope it's useful, Cheers,
AD7six
--Armando Sosa
www.nolimit-studio.com
www.dospuntocero.info
--
Armando Sosa
www.nolimit-studio.com
www.dospuntocero.info
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---
