Re: Curl cost
| From: | tamouse mailing lists | Date: | Wed, 28 Sep 2011 21:28:24 +0000 |
| Subject: | Re: Curl cost | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315049@lists.php.net to get a copy of this message | ||
On Wed, Sep 28, 2011 at 4:06 PM, tamouse mailing lists
<tamouse.lists@gmail.com> wrote:
> On Wed, Sep 28, 2011 at 3:28 AM, muad shibani <muad.shibani@gmail.com> wrote:
>> what are the costs of using PHP Curl to show another websites on my site as
>> stumbleon do ..
>> traffic, memory or what?
>
> If you use curl to suck the web page into a variable, could be
> tremendous. Better to curl it into a temporary file if you're going
> that way.
>
Just a followup -- if you want to show other websites on your own
page, a friendly way to do this is using an iframe:
<?php
$site="http://www.example.com";
?>
<h2><a href="<?php echo $site?>"><?php echo
$site?></a></h2>
<iframe src="<?php echo $site?>" frameborder="0" title="<?php
echo
$site?>" width="80%" height="200px"><span
style="color:red;font-weight:bold;">Your browser does not support
iframes</span></iframe>
That way, the site gets the hit, and you aren't copying anything. If
you do go this way, make sure to provide a break out so the user can
open the target site in a new window/tab.