Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function kodyPocztowe()
- Dim HTTP_SESJA As New ChilkatHttp
- Dim success As Long
- success = HTTP_SESJA.UnlockComponent("xxxxxxxxxxxxxxxxxxxx")
- If (success <> 1) Then
- Debug.Print "Chilkat Error"
- Exit Function
- End If
- HTTP_SESJA.SendCookies = 1
- HTTP_SESJA.SaveCookies = 1
- HTTP_SESJA.Connection = "Keep-Alive"
- HTTP_SESJA.RequiredContentType = "text/html"
- HTTP_SESJA.AllowGzip = 1
- Dim req As New ChilkatHttpRequest
- 'All part with JSON is just experimienting, idk if it is good
- Dim jsonText As String
- jsonText = "{""@context"": ""http://schema.org"", ""@type"": ""WebSite"", ""url"": ""http://www.poczta-polska.pl/"", ""potentialAction"": { ""@type"": ""SearchAction"", ""target"": ""http://www.poczta-polska.pl/?s={search_term}"", ""query-input"": ""required name=search_term""}"
- req.ContentType = "application/x-www-form-urlencoded"
- req.httpVerb = "POST"
- req.Path = "/index.php"
- req.ContentType = "application/x-www-form-urlencoded"
- req.AddHeader "Refferer", "http://kody.poczta-polska.pl/"
- req.AddHeader "Accept", "application/json"
- req.AddParam "page", "kod"
- req.AddParam "kod", "20-610"
- Dim requestMime As String
- requestMime = req.GenerateRequestText()
- Debug.Print requestMime
- Dim resp As New ChilkatHttpResponse
- Set resp = Nothing
- Set resp = HTTP_SESJA.SynchronousRequest("kody.poczta-polska.pl", 80, 0, req)
- HTTP_SESJA.AcceptCharset = ""
- HTTP_SESJA.UserAgent = ""
- HTTP_SESJA.AcceptLanguage = ""
- HTTP_SESJA.AllowGzip = 0
- 'To test what is in resp
- Open "C:\Documents and Settings\xxxxxxxxx\Pulpit\xxxxxxxxx\plik1.html" For Output As #1
- Print #1, resp.BodyStr
- Close #1
- Dim json As New ChilkatJsonObject
- success = json.AppendString("JSON", "kod")
- json.EmitCompact = 0
- success = req.LoadBodyFromString(json.Emit(), "utf-8")
- Set resp = HTTP_SESJA.PostJson("http://kody.poczta-polska.pl/", jsonText)
- 'To test what is in resp
- Open "C:\Documents and Settings\yyyyyyyyyy\Pulpit\yyyyyyyyyy\plik_po_JSON.html" For Output As #1
- Write #1, resp.BodyStr
- Close #1
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement