[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 11-18-2004, 11:41 AM   #1 (permalink)
General Bill
 
billinchina's Avatar
 
Join Date: Nov 2003
Location: Tampa, FL
Posts: 877
586.25 NP$ (Donate)

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';
   
$text2 = 'goodbye world';

   global
$HTTP_GET_VARS;

   
$param2 = $stuff = '';

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

   
$handle = fopen("$param1$param2", 'r');
   while (!
feof($handle))
      
$stuff .= fgets($handle);
   
fclose($handle);

   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, 12:46 PM   #2 (permalink)
Master Your Domains
 
Nexus's Avatar
 
Join Date: Mar 2003
Location: Watertown, MA
Posts: 212
38.05 NP$ (Donate)

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.

~ Nexus
__________________
FreeWho.com - Free Internet Tools!
OPTIMIZE.NET - High Performance Web Mastery!

Last edited by Nexus; 11-18-2004 at 12:51 PM.
Nexus is offline  
Old 11-18-2004, 06:38 PM   #3 (permalink)
General Bill
 
billinchina's Avatar
 
Join Date: Nov 2003
Location: Tampa, FL
Posts: 877
586.25 NP$ (Donate)

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, 09:16 PM   #4 (permalink)
Senior Member
 
Kodeking's Avatar
 
Join Date: Jun 2003
Location: Naperville Illinois
Posts: 1,803
658.75 NP$ (Donate)

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, 09:25 PM   #5 (permalink)
Senior Member
 
superprogrammer's Avatar
 
Join Date: Aug 2004
Location: Washington
Posts: 4,319
0.13 NP$ (Donate)

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


Quote:
Originally Posted by Kodeking
Is ASP just like VB?
Yes..It is similar to VBScript
__________________
Download youtube videos at www.HugYouTube.com and free domains list atwww.FreeDroplists.com
Anonymous access at www.Banned.net
superprogrammer is offline  
Old 11-19-2004, 04:14 AM   #6 (permalink)
Master Your Domains
 
Nexus's Avatar
 
Join Date: Mar 2003
Location: Watertown, MA
Posts: 212
38.05 NP$ (Donate)

Nexus is on a distinguished road


Quote:
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.

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!
OPTIMIZE.NET - High Performance Web Mastery!
Nexus is offline  
Old 11-19-2004, 06:46 AM   #7 (permalink)
General Bill
 
billinchina's Avatar
 
Join Date: Nov 2003
Location: Tampa, FL
Posts: 877
586.25 NP$ (Donate)

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, 08:57 AM   #8 (permalink)
Master Your Domains
 
Nexus's Avatar
 
Join Date: Mar 2003
Location: Watertown, MA
Posts: 212
38.05 NP$ (Donate)

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!
OPTIMIZE.NET - High Performance Web Mastery!
Nexus is offline  
Old 11-19-2004, 03:27 PM   #9 (permalink)
Account Suspended
 
Join Date: Nov 2004
Posts: 59
160.00 NP$ (Donate)

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 07:02 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85