View Full Version : Rewriting code from php to asp
Jessicaaa
01-22-2011, 08:16 PM
Hello ladies and gentlemen!
I need some quick help here, because I have very low developed experience in PHP. I have a code in PHP and really need to rewrite it to the ASP, as my made-up site is built on. Is there some great master coders who can help me, I am very grateful, for helping me.
This code in php is there any way to rewrite it to asp:
function RuneOnline()
{
error_reporting(0);
$url = "http://www.runescape.com/runescape_count_xml.action";
$content = file_get_contents($url);
error_reporting(E_ALL ^ E_NOTICE);
if(is_numeric(trim(strip_tags($content)))) {
return trim(strip_tags($content));
}else{
return 0;
}
}
<?php echo RuneOnline(); ?>
ShaneC
01-22-2011, 08:22 PM
Welcome to Coding Forums!
In an effort to make sure you get the best advice possible, I've moved your thread here as this issue pertains to creating ASP code.
I hope your time here at CF is productive!
Inigoesdr
01-22-2011, 08:32 PM
You should be able to figure this out with some simple Googling.
Find a substitute for file_get_contents (http://www.webconcerns.co.uk/asp/readurlbyasp/readurlbyasp.asp)
Find a substitute for strip_tags() (http://www.dotnetspider.com/resources/4577-Strip-HTML-tags-from-string.aspx)
Find a substitute for trim (http://msdn.microsoft.com/en-us/library/aa903372(v=vs.71).aspx)
Find a substitute for is_numeric() (http://msdn.microsoft.com/en-us/library/6cd3f6w1(v=vs.71).aspx)
Make a Sub for VB :)
Jessicaaa
01-23-2011, 09:00 AM
You should be able to figure this out with some simple Googling.
Find a substitute for file_get_contents (http://www.webconcerns.co.uk/asp/readurlbyasp/readurlbyasp.asp)
Find a substitute for strip_tags() (http://www.dotnetspider.com/resources/4577-Strip-HTML-tags-from-string.aspx)
Find a substitute for trim (http://msdn.microsoft.com/en-us/library/aa903372(v=vs.71).aspx)
Find a substitute for is_numeric() (http://msdn.microsoft.com/en-us/library/6cd3f6w1(v=vs.71).aspx)
Make a Sub for VB :)
Thanks alot dude, but i really don't get it. I looked over all the pages you have linked, with was a huge help for me. But the code don't work, i don't think i understand how to rewrite it right.
Is there any possible you could just rewrite it to asp so i can look over it, and see how you did.
Old Pedant
01-23-2011, 08:59 PM
That's actually a pretty tall order. Trying to emulate all those PHP functions exactly in ASP code.
It would be a ton easier if you could show some samples of what you expect to find in that "runescape_count_xml.action" and we try to find a more sensible way to accomplish the same thing, rather that duplicating the PHP code.
Jessicaaa
01-25-2011, 12:54 AM
Oh i see, my gosh!
The runescape code will automactyl calcute how many users are online at the game runescape.com. It was really hard to find the code, and like always, i found it in php code. :(
Old Pedant
01-29-2011, 09:26 PM
So show us a sample of the contents of http://www.runescape.com/runescape_count_xml.action and it would be easier to make a stab at this.
I just tried to hit that URL and got nothing but a 404 (page not found) error.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.