Sign in to follow this  
Followers 0
Mithrandir

Help using winhttp to send data using linksave API

3 posts in this topic

#1 ·  Posted (edited)

This is my first time working with an API. I chose this one: http://linksave.in/api Here it's what it says:

For registered users:

The following data has to be sent by POST to our API:

They are:

URL: http://linksave.in/protect?api=[username]:[Password]

Field name: Value:

*save = TRUE

*links = [Links](seperated each by a line break "\n")

mirrors = [Mirrorlinks](seperated each by a line break "\n")

foldername = [Name of the folder]

myprotection = container_js (Container and webprotection)

container_plain (Container and premiumlinks)

container (only container

plain (only Premiumlinks)

js (only Webprotection)

container_types = rsdf ccf and/or dlc(not seperated)

container_name = [only Webprotection](if empty then foldername)

category = [name or number of the cateorgy, in which the folder will be moved; 0 for no category]

advertisement =

banner

bannerurl = [bannerurl](URL to bannerpicture)

bannerlink = [bannerlink](Link banner with this URL)

location = captchaseite(Show banner on captchapage)

frame(Show banner in hosterframe)

unten(Show banner below the links)

oben(Show banner above the links)

adminpassword = [adminpassword](if empty then random password)

visitorpassword = [Password to visit the folder]

cover = [Describing picture of the folder contents]

website = URL to your website

captcha = on or off

notify = 1 or 0 (Notification if files are offline)

email = [E-mail-address for notifications]

* = Required

Improtant: If you leave one or more fields empty, the corresponding value from your userCP-settings will apply.

Return values:

Standard = http://linksave.in/[Folder-ID]

[On error(s)] = ERROR

[Exact Errormessage(s)](seperated each by"|")

The problem that I found is that I find the documentation quite ambiguous or maybe it's my lack of experience, anyway I coded this:

#include <WinHttp.au3>

Global $sUserName = "Myuser"
Global $sPassword = "Mypass"
Global $sDomain = "www.linksave.in"
Global $sLinks = "http://www.fileserve.com/file/bByhbBm"
Global $sAdditionalData = "save=TRUE&links="&$sLinks&"foldername=testfolder&captcha=off"
;Global $sAdditionalData = "ordnername=testfolder&links=http%3A%2F%2Fwww.fileserve.com%2Ffile%2FbByhbBm"& _
;"myschutz=container_js&container_rsdf=1&container_ccf=1&container_dlc=1&captcha=N"

Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6")

Global $hConnect = _WinHttpConnect($hOpen, $sDomain)

Global $hRequest = _WinHttpOpenRequest($hConnect, "POST","/protect?api="&$sUserName&":"&$sPassword)

_WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $sAdditionalData)

_WinHttpReceiveResponse($hRequest)

Global $sReturned
If _WinHttpQueryDataAvailable($hRequest) Then
    Do
        $sReturned &= _WinHttpReadData($hRequest)
    Until @error
EndIf

_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

MsgBox(0, "Returned", $sReturned)
ConsoleWrite($sReturned)
FileWrite(@ScriptDir&'/htmlreturned.html',$sReturned)

I even saved a link manually and traced the process with live http headers in firefox. I saw that the additional data was sent in german so I try that -That's the 'Global...' that is commented in the code- but it didn't function either. In both cases it returns the page in the html as if I had used a get request :huh2: I'm quite puzzled. Can anyone give me some directions? Thanks for your help!

Edited by Mithrandir

Share this post


Link to post
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
Sign in to follow this  
Followers 0