Jump to content

Recommended Posts

Posted

Any ideas how to build a string that is suitable to be passed to a php script on a server? What I am trying to do is build a string that is:

http://www.somesite.com/ascript.php?url=

-http://www.anotherurl.com/file.pl?option1=string1 etc

In Autoit3 how do i put this into the proper escaped format so that the php script on the server can unescape it and use it as input parameter? (I know how to take URLs in php and unescape them)

Any ideas?

Posted (edited)

$url = "http://www.anotherurl.com/file.pl?option1=" & $string1

is that what you mean ?

No. I mean is the a function to convert a normal string to an escaped format for use within a web browser:

For example:

-somescript?name="Espen Lyngaas"&age=I'm 32 years old

To be converted to:

-somescript?name=%22Espen+Lyngaas%22&age=I%27m+32+years+old

This can then be fed to a browser to run a program on a web server with two input parameter of name and age, you see?

Edited by oldgeezer
Posted

Possible approach:

$t = '-somescript?name="Espen Lyngaas"&age=I''m 32 years old'
;Note:  had to add an extra apostrophe for AutoIt to accept the string....

$t = StringReplace($t, '"', "%22")
$t = StringReplace($t, '"', "%27")
$t = StringReplace($t, "(", "%28")
$t = StringReplace($t, ")", "%29")
$t = StringReplace($t, "@", "%40")

$t = StringReplace($t, " ", "+")
;$t = StringReplace($t, " ", "%20")

;$t = StringReplace($t, "?", "%3F")
;$t = StringReplace($t, "=", "%3D")
;$t = StringReplace($t, "&", "%26")

MsgBox(4096,"Output", $t)
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted (edited)

Possible approach:

$t = '-somescript?name="Espen Lyngaas"&age=I''m 32 years old'
;Note:  had to add an extra apostrophe for AutoIt to accept the string....

$t = StringReplace($t, '"', "%22")
$t = StringReplace($t, '"', "%27")
$t = StringReplace($t, "(", "%28")
$t = StringReplace($t, ")", "%29")
$t = StringReplace($t, "@", "%40")

$t = StringReplace($t, " ", "+")
;$t = StringReplace($t, " ", "%20")

;$t = StringReplace($t, "?", "%3F")
;$t = StringReplace($t, "=", "%3D")
;$t = StringReplace($t, "&", "%26")

MsgBox(4096,"Output", $t)
Thanks Cyberslug.

Yes I see.. Is there a complete list on the web of these special characters and corresponding values they have to be converted to?

Thanks.

edit: Is this http://webdesign.about.com/od/characterset...l_htmlcodes.htm basically the sort of table i need to use, i guess.

Edited by oldgeezer

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...