brandon-estrella-dev
brandon-estrella-dev

Reputation: 397

using CURL, need to refresh URL without page refresh PHP

Is there a way to refresh the $url variable? I would like to pull data from that link every 2 minutes or so. I am using a php include('marquee.php') tag on the page that I would like the marquee to be displayed. I understand the marquee tag needs a lot of work to be smooth, but for now this works for what I'm trying to accomplish. The Marquee is working great, the problem is if I try to use a

<meta http-equiv='refresh' content='120' />;

in marquee.php page, when the content refreshes, it also refreshes the entire page that the marquee is being displayed on. How can I prevent the page that is displaying the marquee from being refreshed? I am open to other/better ways to get this done, Thank you in advance!

marquee.php

$url="http://www.somesite.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);

//extracting the data that I need and echoing it through a marquee tag

echo '<marquee>'; 
    $number = 0;
    $i = 0;
    while($number<=16){
    echo $teamAr[$i++].')&emsp;&emsp;&emsp;';

           $number++; 
    }

echo       '</marquee>';

Upvotes: 0

Views: 2533

Answers (1)

Mike Brant
Mike Brant

Reputation: 71384

cURL will not help you. If you want to update conetent on your page without a refresh, your only option is AJAX.

Upvotes: 2

Related Questions