Jump to content

converting PHP to autoit - some functions needed


Recommended Posts

hi all,

i am trying to convert some code from php to autoit.

There are some functions that may exist in autoit, but are unknown to me.

So if anyone can point me to the right func or has an idea how to code the needed func i would be glad fo any hint. Thanks in Advance !!

The PHP function i need in autoit are:

simplexml_load_string

http://php.net/manual/en/function.simplexml-load-string.php

mb_convert_encoding

http://de3.php.net/manual/en/function.mb-convert-encoding.php

and i also need curl function that allow for

curl_init(...)

curl_setopt(...)

curl_exec(...)

curl_close(...)

The curl function i found did not allow this kind of usage...

Again, any hint, link or code is welcome.

Thank you very much!

Link to comment
Share on other sites

This is where the AutoIt community comes into its own. There is an XML UDF floating about around here. Although the last update was in 2010, there may be other UDFs that are newer and better, I don't know.

As for mb_convert_encoding... I don't know.

And for cURL functions, seangriffin has an excellent UDF here.

The function names wont match PHP precisely, but I'm sure you'll be able to work them out.

Link to comment
Share on other sites

To convert encdoings, those functions should cover the usual cases:

_WinAPI_MultiByteToWideChar

_WinAPI_WideCharToMultiByte

BinaryToString

StringToBinary

Depending on th extend you use curl, InetRead / InetGet could suffice. Another alternative is WinHTTP (my signature contains a link)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Problem solved...

now i am looking for something like this:

http://php.net/manual/de/function.http-build-query.php

it translates an array to an url in the from of

foo=bar&baz=boom&cow=milch&php=hypertext+processor

is the a func in autoit to do this?

Link to comment
Share on other sites

I get totally engrossed when I look at the PHP website, not that I have much experience with it. Anyway, there is no associative array type in AutoIt. I think some people have attempted to create something like that, and it's possible you might find something useful in Example Scripts. You could create a similar function using a 2D array. I'm not sure if this helps you.

Dim $array[4][2] = _
[["foo","bar"], _
["baz","boom"], _
["cow","milch"], _
["php","hypertext+processor"]]

MsgBox(0, "Result",_BuildString($array))

Func _BuildString($array, $delim1 = "=", $delim2 = "&")
    If UBound($array, 2) < 2 Then Return SetError (1, 0, "")
    Local $sRet = ""
    For $i = 0 To UBound($array) -1
        $sRet &= $array[$i][0] & $delim1 & $array[$i][1] & $delim2
    Next
    Return StringTrimRight($sRet, 1)
EndFunc
Link to comment
Share on other sites

Search for "scripting dictionary" and you're done.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I get totally engrossed when I look at the PHP website, not that I have much experience with it. Anyway, there is no associative array type in AutoIt. I think some people have attempted to create something like that, and it's possible you might find something useful in Example Scripts. You could create a similar function using a 2D array. I'm not sure if this helps you.

thank you very much...yes the array type is a problem..i will play a bit with it...thanks for the code !

Link to comment
Share on other sites

Let me try again: use the forum search feature for quoted words.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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