Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I'm looking for a way to post text data I get from a text field within a writer odt document.

My macro looks like this:


  sURL = "https://myserver/webservice/index.php";
  sBody = "param1=" & stextfield1


  oInput = Post(sURL, sBody)



Function Post(sURL As String, sBody As String) As Variant
  oUCB = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
  oId = oUCB.createContentIdentifier(sURL)
  oContent = oUCB.queryContent(oId)
  
  oDataSink = CreateUnoListener("XDataSink_", _
      "com.sun.star.io.XActiveDataSink")
  
  oCommandEnv = CreateUnoListener("XCommandEnv_", _
      "com.sun.star.ucb.XCommandEnvironment")
  
  oBodyStream = CreateUnoService("com.sun.star.io.Pipe")
  oTextOutput = CreateUnoService("com.sun.star.io.TextOutputStream")
  oTextOutput.setOutputStream(oBodyStream)
  oTextOutput.writeString(sBody)
  oTextOUtput.closeOutput()
  
  oPostArgs = CreateUnoStruct("com.sun.star.ucb.PostCommandArgument2")
  oPostArgs.Source = oBodyStream
  oPostArgs.Sink = oDataSink
  
  aCommand = CreateUnoStruct("com.sun.star.ucb.Command")
  aCommand.Name = "post"
  aCommand.Argument = oPostArgs
  
  oRet = oContent.execute(aCommand, -1, oCommandEnv)
  
  oInput = oDataSink.getInputStream()
  Post = oInput
End Function
 
 
 
Dim oStream As Variant
Function XDataSink_setInputStream(oLocStream As Variant)
  oStream = oLocStream
End Function
Function XDataSink_getInputStream() As Variant
  XDataSink_getInputStream = oStream
End Function
 
 
Function XCommandEnv_getInteractionHandler()' As Variant
  XCommandEnv_getInteractionHandler = CreateUnoListener(_
      "XInteractionHandle_", "com.sun.star.task.XInteractionHandler")
End Function
Function XCommandEnv_getProgressHandler()' As Variant
  XCommandEnv_getProgressHandler = CreateUnoListener(_
      "XProgressHandle_", "com.sun.star.ucb.XProgressHandler")
End Function
 
 
Function XInteractionHandle_handle(oRequest)
End Function
 
Function XProgressHandle_push(nStatus)
End Function
Function XProgressHandle_update(nStatus)
End Function
Function XProgressHandle_pop()
End Function


However, my PHP script doesn't receive the 'param1' variable despite the fact that it does receive 
a POST request.

What am I doing wrong?
Are there other methods to do this?

Thanks,

Vieri


-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.