Log in

View Full Version : How To Post Using Mac



ajarmstron
08-16-2020, 12:15 PM
Hi I am trying to send a Post request to a MySQL online database using a PowerPoint VBA Macintosh.

I have tried using the following code, but am receiving issues in accessing the library function.



Private Declare PtrSafe Function system Lib "libc.dylib" (ByVal command As String) As Long

Function getHTTPPost(sUrl As String, sQuery As String) As Long
sCmd = "curl -v -X POST -d '" & sQuery & "' " & sUrl
exitCode = system(sCmd)
End Function

ans = getHTTPPost("http:myserver/AddNew.php?", "name=JoeBloggs&score=20")


However, this code is returning an error: File not found: libc.dylib


I did an online search and found this issue has arisen after some kind of update https://github.com/VBA-tools/VBA-Web/issues/385


The solution indicated is to set the location of the Library file name to "/usr/lib/libc.dylib". Hence I changed the line to:



Private Declare PtrSafe Function system Lib "/usr/lib/libc.dylib" (ByVal command As String) As Long


However, at the moment I continue to get a file not found error. I would be very grateful if anyone could tell me what the correct Mac Function Declaration is.

Thank you for any comments!