Als je now.in gebruikt en je luistert naar een radio kan je ook zien hoeveel luisteraars erzijn, hoe kan je die op je site krijgen?
Now.in
Je zou get content kunnen doen en dan preg_replace of een van de andere functies om te weten hoeveel er zijn.
Die code in je onderschrift klopt ook langs geen klote
.
Die code in je onderschrift klopt ook langs geen klote
.Alemaalte schreef:Code?Je zou get content kunnen doen en dan preg_replace of een van de andere functies om te weten hoeveel er zijn.
codedump.com/sdis29SDi92
toevoeging op 23 februari 2012, 19:54:36:
Dus als je ff had gegoogled:
toevoeging op 23 februari 2012, 19:54:36:
Dus als je ff had gegoogled:
$url = http://www.website.nl;
$string = file_get_contents($url);
if (preg_match(/<div id="div1">([^<]*)</div>/, $string, $matches) > 0) {
echo $matches[1]; //This is text one
} Dit kan je zo terugvinden in Google?
Milan schreef:toevoeging op 23 februari 2012, 19:54:36:
Dus als je ff had gegoogled:
$url = http://www.website.nl;
$string = file_get_contents($url);
if (preg_match(/<div id="div1">([^<]*)</div>/, $string, $matches) > 0) {
echo $matches[1]; //This is text one
} Het is geen div maar een dd ofz?
<dd id="listener" title="Number of online listeners"> Kan je precies hetzelfde doen
[COLOR= #0000BB]<?php
$url[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]http://now.in/radio/lol[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]/<dd id="listener" title="Number of online listeners">([^<]*)</dd>/[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$matches[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];[/COLOR] [COLOR= #FF8000]//This is text one[/COLOR]
[COLOR= #007700]}[/COLOR]
?> werkt niet