<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>url</Name>
  <Description>Get content from or post data to remote url.</Description>
  <Example>
  
   // load content from url. 
    var webcontent =  k.url.get("http://www.kooboo.com"); 
    
    // post content. 
    k.url.post("http://www.kooboo.com","data as string");  
    
  </Example>
  <Props />
  <Methods>
    <Method>
      <Name>get</Name>
      <Description>Get data string from the url</Description>
      <Example>
        // load content from url.
        var webcontent =  k.url.get("http://www.kooboo.com");  
      </Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>destination url</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
    <Method>
      <Name>Get</Name>
      <Description>get data string from remote url by using  HTTP Basic authentication</Description>
      <Example>
        // load content from url.
        var webcontent =  k.url.get("http://www.kooboo.com", "username", "password");
      </Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>url</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>username</Name>
          <Description>username</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>password</Name>
          <Description>password</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
    <Method>
      <Name>post</Name>
      <Description>Post data to remote url</Description>
      <Example><![CDATA[
      var data = "name=myname&field=value"; 
      k.url.post("http://www.kooboo.com/fakereceiver", data); 
      ]]></Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>url</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>data</Name>
          <Description>The form data to post</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
    <Method>
      <Name>post</Name>
      <Description>Post data to remote url using HTTP basic authentication</Description>
      <Example><![CDATA[
        var data = "name=myname&field=value";
        k.url.post("http://www.kooboo.com/fakereceiver", data, "username", "password");
      ]]></Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>url</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>data</Name>
          <Description>data</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>userName</Name>
          <Description>userName</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>password</Name>
          <Description>password</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
    <Method>
      <Name>postData</Name>
      <Description>Post data as JSON to remote url using HTTP basic authentication</Description>
      <Example>
        var obj = {fieldone:"valueone", fieldtwo: "valuetwo"};
        k.url.postData("http://www.kooboo.com/fakereceiver", obj, "username", "password");
      </Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>url</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>data</Name>
          <Description>The object to post</Description>
          <Type>object</Type>
        </Param>
        <Param>
          <Name>userName</Name>
          <Description>userName, can be null</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>password</Name>
          <Description>password, can be null</Description>
          <Type>string</Type>
        </Param>
      </Params>
      <ReturnType>string</ReturnType>
    </Method>
  </Methods>
</KScriptSetting>