du er nød til at lave din $vidurl global, eller sende den med ind i din function som et argument.
- <?php
- $vidurl = $_GET['id'];
- function fb_count($id) {
- global $fbcount;
- $facebook = file_get_contents("http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.fniis.dk/video.php?id=$id");
- $fbbegin = '<share_count>'; $fbend = '</share_count>';
- $fbpage = $facebook;
- $fbparts = explode($fbbegin,$fbpage);
- $fbpage = $fbparts[1];
- $fbparts = explode($fbend,$fbpage);
- $fbcount = $fbparts[0];
- if($fbcount == '') { $fbcount = '0'; }
- }
- fb_count( $vidurl );
- ?>
- <?php
- $vidurl = $_GET['id'];
- function fb_count() {
- global $fbcount, $vidurl;
- $facebook = file_get_contents("http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.fniis.dk/video.php?id=$vidurl");
- $fbbegin = '<share_count>'; $fbend = '</share_count>';
- $fbpage = $facebook;
- $fbparts = explode($fbbegin,$fbpage);
- $fbpage = $fbparts[1];
- $fbparts = explode($fbend,$fbpage);
- $fbcount = $fbparts[0];
- if($fbcount == '') { $fbcount = '0'; }
- }
- fb_count();
- ?>