NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Convert PHP to ASP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-18-2004, 12:41 PM THREAD STARTER               #1 (permalink)
General Bill
 
billinchina's Avatar
Join Date: Nov 2003
Location: Tampa, FL
Posts: 878
billinchina is a jewel in the roughbillinchina is a jewel in the roughbillinchina is a jewel in the rough
 



Convert PHP to ASP


How would you convert this function to asp:

PHP Code:
function hello_world()
{
   
$text1 'hello world';
????: NamePros.com http://www.namepros.com/programming/56041-convert-php-to-asp.html
   
$text2 'goodbye world';

   global 
$HTTP_GET_VARS;

   
$param2 $stuff '';

   if (isset(
$HTTP_GET_VARS['yea']))
   {
      if (
substr($HTTP_GET_VARS['yea'], 03) === 'yea')
         return 
serialize(array($text1$text2));
   }
   
$param1 urlencode($text1);

   
$handle fopen("$param1$param2"'r');
   while (!
feof($handle))
      
$stuff .= fgets($handle);
   
fclose($handle);
????: NamePros.com http://www.namepros.com/showthread.php?t=56041

   return 
$stuff;

__________________
A good name is rather to be chosen than great riches, and loving favour rather than silver and gold. Proverbs 22:1
billinchina is offline  
Old 11-18-2004, 01:46 PM   #2 (permalink)
Master Your Domains
 
Nexus's Avatar
Join Date: Mar 2003
Location: Watertown, MA
Posts: 222
Nexus is on a distinguished road
 



Hi, Bill... no time to debug or test it, but this should be the right general direction...
Code:
Function helloWorld()

   dim text1,text2,param,stuff
   dim handle

   text1 = "hello world"
   text2 = "goodbye world"

   MySer = Server.CreateObject("WDDX.Serializer.1")
   handle = Server.CreateObject("Msxml2.ServerXMLHTTP")

   If (Request.QueryString("yea")) Then
      If (Mid(Request.QueryString("yea"), 0, 3) === "yea") Then
         helloWorld = MySer.Serialize(array(text1,text2)); 
      End If
   End If 
   param1 = Server.URLEncode(text1)

   handle.open "GET", param1 & param2, False
   handle.send
   stuff = handle.responseText
   handle = Nothing

   helloWorld = stuff

End Function
I might look at that the handling of that array in a bit more of a formal way though (setting it to a variable before assigning that variable to something else). Not sure if ASP will like that "on the fly" stuff.
????: NamePros.com http://www.namepros.com/showthread.php?t=56041

~ Nexus
__________________
FreeWho.com - Free Internet Tools!
Last edited by Nexus; 11-18-2004 at 01:51 PM.
Nexus is offline  
Old 11-18-2004, 07:38 PM THREAD STARTER               #3 (permalink)
General Bill
 
billinchina's Avatar
Join Date: Nov 2003
Location: Tampa, FL
Posts: 878
billinchina is a jewel in the roughbillinchina is a jewel in the roughbillinchina is a jewel in the rough
 



Thanks, I'm going to check this out later... I really appreciate your help.
__________________
A good name is rather to be chosen than great riches, and loving favour rather than silver and gold. Proverbs 22:1
billinchina is offline  
Old 11-18-2004, 10:16 PM   #4 (permalink)
Senior Member
 
Kodeking's Avatar
Join Date: Jun 2003
Location: Naperville Illinois
Posts: 1,786
Kodeking is just really niceKodeking is just really niceKodeking is just really niceKodeking is just really nice
 



Is ASP just like VB?
__________________
Quote:
Clan-Forums.com >> $30 BoardingForum.com >> $100
TalkWebHosting.com >> $200 AvoidChapter13.com >> $100
Send PM to make lesser offers on the above names.
Kodeking is offline  
Old 11-18-2004, 10:25 PM   #5 (permalink)
Senior Member
 
superprogrammer's Avatar
Join Date: Aug 2004
Location: Washington
Posts: 4,327
superprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud ofsuperprogrammer has much to be proud of
 



Originally Posted by Kodeking
Is ASP just like VB?
Yes..It is similar to VBScript
__________________
Download youtube videos at www.HugYouTube.com -NO LINKS TO PARKED PAGES-
Anonymous access at www.Banned.net
superprogrammer is offline  
Old 11-19-2004, 05:14 AM   #6 (permalink)
Master Your Domains
 
Nexus's Avatar
Join Date: Mar 2003
Location: Watertown, MA
Posts: 222
Nexus is on a distinguished road
 



Originally Posted by Kodeking
Is ASP just like VB?
Not just "similar". VBscript is a universal language Microsoft has wound through many of its products. While depending on the environment you many have more or less options, the language syntax is often the same. Similarly, you can configure ASP to use Javascript or Perl as its language. The only caveat is that its all or nothing. A "Javascript" page cannot include a VBScript page. Once you choose your language, you're off.
????: NamePros.com http://www.namepros.com/showthread.php?t=56041

Bill, if you weren't bound by the above (your code is nastled in a bunch of other VB code), I'd use Javascript for your language interpreter. PHP is much easier to port to Javascript than VBscript. You get to keep your "{" and "}" structures, and your ";" at the end of your lines.

~ Nexus
__________________
FreeWho.com - Free Internet Tools!
Nexus is offline  
Old 11-19-2004, 07:46 AM THREAD STARTER               #7 (permalink)
General Bill
 
billinchina's Avatar
Join Date: Nov 2003
Location: Tampa, FL
Posts: 878
billinchina is a jewel in the roughbillinchina is a jewel in the roughbillinchina is a jewel in the rough
 



If I serialize an asp array with this:

helloWorld = MySer.Serialize(array(text1,text2));

Can I unsearialize it with php unserialize?
__________________
A good name is rather to be chosen than great riches, and loving favour rather than silver and gold. Proverbs 22:1
billinchina is offline  
Old 11-19-2004, 09:57 AM   #8 (permalink)
Master Your Domains
 
Nexus's Avatar
Join Date: Mar 2003
Location: Watertown, MA
Posts: 222
Nexus is on a distinguished road
 



Not really... put you'd be able to convert it. The MS serialization method "serializes" to XML. If you have a particular XML to array function you use in PHP, then that would solve it. I have one I use I could pass to you. You'd just need to compare the array you're expecting with the array you get (from doing this), and adjust it however necessary.

~ Nexus
__________________
FreeWho.com - Free Internet Tools!
Nexus is offline  
Old 11-19-2004, 04:27 PM   #9 (permalink)
Account Suspended
Join Date: Nov 2004
Posts: 58
Question? is an unknown quantity at this point
 



basicly i thought they were the same? but now i saw ASP is a lot lot harder dont ya think? gimme your comments.
Question? is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:33 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger