ISDBDownloader::GetURLContentEx: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
(Created page with "===Parameters=== {{MethodParameters |URL |String |URL of the content to get |Headers | ISDBStringList| Custom request headers to send (e.g. "Accept-Language: en-us") |Bo...")
 
 
Line 35: Line 35:
   Headers.Add "My-Header: My Custom Header Content"
   Headers.Add "My-Header: My Custom Header Content"
   Dim Content
   Dim Content
   Content = SDB.Downloader.GetURLContent("http://pgl.yoyo.org/http/browser-headers.php", Headers, "My Post body")
   Content = SDB.Downloader.GetURLContentEx("http://pgl.yoyo.org/http/browser-headers.php", Headers, "My Post body")
   MsgBox( Content)
   MsgBox( Content)
End Sub
End Sub

Latest revision as of 11:47, 14 May 2013

Parameters

Name Type Description
URL String URL of the content to get
Headers ISDBStringList Custom request headers to send (e.g. "Accept-Language: en-us")
Body String Body to POST, if the Body is empty string then HTTP GET is used otherwise HTTP POST method is used


Method description

Returns URL content.

Added in MediaMonkey 4.1.0.1638

Example code

Option Explicit

Dim UI  : Set UI = SDB.UI

Sub OnStartUp()
    Dim mnuTest

    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = SDB.Localize("Get URL content")
    mnuTest.OnClickFunc = "SDBOnClick"
    mnuTest.UseScript = Script.ScriptPath   
End Sub

Sub SDBOnClick(Item)   
  Dim Headers
  Set Headers = SDB.NewStringList 
  Headers.Add "Accept-Language: en-us"
  Headers.Add "My-Header: My Custom Header Content"
  Dim Content
  Content = SDB.Downloader.GetURLContentEx("http://pgl.yoyo.org/http/browser-headers.php", Headers, "My Post body")
  MsgBox( Content)
End Sub