AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke JSON-Abfrage mit Indy-Komponenten
Thema durchsuchen
Ansicht
Themen-Optionen

JSON-Abfrage mit Indy-Komponenten

Ein Thema von tkoenig · begonnen am 2. Aug 2012 · letzter Beitrag vom 21. Jan 2025
Antwort Antwort
tkoenig

Registriert seit: 16. Mär 2010
Ort: Dresden
19 Beiträge
 
Delphi XE7 Professional
 
#1

JSON-Abfrage mit Indy-Komponenten

  Alt 2. Aug 2012, 11:47
Malzeug zusammen,

Ich versuche zur Zeit, mich ein wenig mit Delphi-Programmierung und Internet. Als kleines Test-Projekt will ich jetzt sozusagen eine automatisierte Datenbank mit Auswertungen über meinen World of Tanks Clan basteln. Erster Schritt ist das Auslesen der Mitglieder. Diese finde ich auf http://worldoftanks.eu/community/clans/500010608-G0LD/ unten in der Tabelle. Diese Seite abzufragen ist mit idHTTP kein Problem, funktioniert auch wunderbar. Das Problem ist die eigentliche Tabelle.

Diese wird durch eine separate Abfrage mit JSON-Daten gefüllt. Ich habe diese JSON-Abfrage mit Fiddler mitgeschnitten und versuche nun, sie nachzubauen:
Delphi-Quellcode:
procedure TForm1.InitHTTP;
begin
  clan_request := TIdHTTP.Create(nil);
  clan_request.AllowCookies := true;
  clan_request.CookieManager := IdCookieManager1;
  clan_request.Request.Accept := 'application/json, text/javascript, */*; q=0.01';
  clan_request.Request.AcceptEncoding := 'gzip, deflate';
  clan_request.Request.AcceptLanguage := 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
  clan_request.Request.UserAgent := 'Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1';
  clan_request.Request.Connection := 'keep-alive';
end;

function TForm1.GetClanMembers: string;
var url: string;
begin
  clan_request.Request.Referer := 'http://worldoftanks.eu/community/clans/500010608-G0LD/';
  url := 'http://worldoftanks.eu/community/clans/500010608/members/?type=table&_=1343897160069&offset=0&limit=100&order_by=date&search=&echo=1&id=clan_members_index';

  result := clan_Request.Get(url);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  InitHTTP;
  Memo1.Text := GetClanMembers;
end;
Wenn ich das ganze jetzt ausführe, bekomme ich von den Indy-Komponenten den schicken 404-Fehler, die selbe Abfrage in Firefox bringt ebenfalls 404.




Das ist die Abfrage mit Fiddler im Firefox mitgeschnitten:
Code:
GET /community/clans/500010608/members/?type=table&_=1343897160069&offset=0&limit=100&order_by=date&search=&echo=1&id=clan_members_index HTTP/1.1
Host: worldoftanks.eu
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-Requested-With: XMLHttpRequest
X-CSRFToken: f1ba[...]
Referer: http://worldoftanks.eu/community/clans/500010608-G0LD/
Cookie: csrftoken=f1ba[...]; __utma=4768[...]; __utmz=4768[...]; csw_popup=true; csw_top=true; __atuvc=0%7C27[...]; map_visited=visited; sessionid=4169[...]; __utmb=4768[...]; __utmc=4768[...]
Und das die Response:
Code:
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 02 Aug 2012 08:45:01 GMT
Content-Type: application/x-javascript; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Content-Language: de
Expires: Thu, 02 Aug 2012 08:45:01 GMT
Vary: Accept-Language,Cookie
Cache-Control: max-age=0
X-Frame-Options: SAMEORIGIN
Last-Modified: Thu, 02 Aug 2012 08:45:01 GMT
Content-Length: 3389

{"request_data": {"items": [{"account_id": 502193135, "member_since": 1341865478.0, "banned": false, "role_id": "recruiter", "role": "Anwerber", "name": "DirtBoar"}, {"account_id": 501768136, "member_since": 1341868994.0, "banned": false, "role_id": "vice_leader", "role": "Vize-Kommandant", "name": "Feldlerche"}, {"account_id": 501035259, "member_since": 1341868520.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "grypsi"}, {"account_id": 500884039, "member_since": 1341851636.0, "banned": false, "role_id": "vice_leader", "role": "Vize-Kommandant", "name": "J0hnn1R1c0"}, {"account_id": 503501995, "member_since": 1341858484.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "J4neR1c0"}, {"account_id": 502443788, "member_since": 1341858242.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "kartoffelsnack"}, {"account_id": 500946565, "member_since": 1341856252.0, "banned": false, "role_id": "leader", "role": "Kommandant", "name": "Mounty77"}, {"account_id": 502549571, "member_since": 1341859406.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Oscibar"}, {"account_id": 500778372, "member_since": 1341865757.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Pinni1966"}, {"account_id": 502699913, "member_since": 1341859919.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "pollaka"}, {"account_id": 500444120, "member_since": 1341852198.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Rappel_Kiste"}, {"account_id": 502809062, "member_since": 1341852215.0, "banned": false, "role_id": "recruiter", "role": "Anwerber", "name": "Spongebob0815"}, {"account_id": 501282218, "member_since": 1341852095.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "_Kongo_Otto_"}, {"account_id": 503879690, "member_since": 1341954738.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Alugard"}, {"account_id": 502106765, "member_since": 1341922550.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Falkendiek"}, {"account_id": 502030315, "member_since": 1341927553.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "maeh_schaf"}, {"account_id": 500479782, "member_since": 1342024955.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Connor20"}, {"account_id": 502771231, "member_since": 1342123538.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Barobee"}, {"account_id": 502673906, "member_since": 1342224902.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Seerolf1971"}, {"account_id": 502834075, "member_since": 1342362285.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "cuub"}, {"account_id": 500701483, "member_since": 1342549267.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Wolf70"}, {"account_id": 502655743, "member_since": 1342685260.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Action_Horst"}, {"account_id": 501868882, "member_since": 1342719661.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "Euli"}, {"account_id": 504288425, "member_since": 1342885125.0, "banned": false, "role_id": "private", "role": "Soldat", "name": "DackNacken"}], "total_count": 24, "filtered_count": 24, "offset": 0, "echo": 1}, "result": "success"}
Mich interessieren wirklich nur die JSON-Daten, was kann ich noch tun? Hat es vielleicht was mit den Cookies zu tun? Ich bin für jede Hilfe dankbar.

Grüße, tkoenig
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.006 Beiträge
 
Delphi 2009 Professional
 
#2

AW: JSON-Abfrage mit Indy-Komponenten

  Alt 2. Aug 2012, 11:55

Hat es vielleicht was mit den Cookies zu tun?
Ja, erst muss der Client auf eine Seite zugreifen die ihm die Sessioncookies in der HTTP Antwort mitsendet (z.B. eine Loginseite).

Indy speichert die Cookies im Cookiemanager und sendet sie bei der HTTP Anfrage auf die API-URL dann mit.
Michael Justin
  Mit Zitat antworten Zitat
tkoenig

Registriert seit: 16. Mär 2010
Ort: Dresden
19 Beiträge
 
Delphi XE7 Professional
 
#3

AW: JSON-Abfrage mit Indy-Komponenten

  Alt 2. Aug 2012, 12:19
Danke für die schnelle Antwort. Habe mal fix nachgeschaut. Der wichtige Cookie (csrftoken) wird bei Aufruf der eigentlichen Seite gesetzt, Aufruf dieser Seite vorher bringt aber auch nichts, Fehler 404 bleibt der selbe

Edit: Problem gelöst, es lag an dem Header "X-Requested-With: XMLHttpRequest"
clan_request.Request.CustomHeaders.Add('X-Requested-With: XMLHttpRequest'); hat zumindest den 404-Fehler behoben.

Geändert von tkoenig ( 2. Aug 2012 um 12:36 Uhr)
  Mit Zitat antworten Zitat
Rogergox

Registriert seit: 17. Jan 2025
1 Beiträge
 
#4

Best Bitcoin Mixer Services 2025

  Alt Gestern, 18:51
Bitcoin Mixers and Tumblers: Websites Overview


Bitcoin Mix

Bitcoin Mix is a trusted service for anonymous and secure BTC mixing. The platform offers a high level of privacy, low fees, and coins with verified history. Operating since 2017, Bitcoin Mix has established itself as a reliable tool for ensuring anonymity in blockchain transactions. The main goal of the service is to provide users with the ability to maintain confidentiality without compromise.

Advantages of Bitcoin Mix


Complete Privacy: All data is deleted immediately after the transaction is completed. The platform follows a strict no-log policy, retaining no user information.
Instant Transactions: Thanks to internal reserves, the service ensures immediate transaction execution, eliminating the wait for transaction pool confirmation.
Support for Modern Addresses: Compatibility with SegWit and bech32 speeds up transaction processing.
Flexible Transaction Delays: Users can set a delay of up to 7 days to enhance anonymity.
Dynamic Fees: Option to set fees within a range of 0.52.5%.


How Does Bitcoin Mix Work?


Enter the wallet address(es) where you want to receive "clean" coins. The minimum transfer amount is 0.005 BTC.
Set your preferences: choose delay and fee levels.
Leave the mixing code field blank if this is your first time using the service.
Receive the deposit address and send your coins within 24 hours.
Download the guarantee letter confirming your payment.


The process is fully automated. There is no need to keep your browser openthe service ensures security and ease of use.

Why Choose Bitcoin Mix?


Years of Experience: Since 2017, the platform has been helping users maintain confidentiality.
Modern Technology: Support for new address formats and instant transactions.
Ease of Use: An intuitive interface and automated process.


Useful Links:


Official Website
TOR Mirror


Bitcoin Mix is your best choice for safe and anonymous BTC mixing.


Bitcoin Mixers and Tumblers: Understanding the Basics

Introduction to Bitcoin Tumblers

Bitcoin tumblers, also known as mixers, are essential tools for cryptocurrency users seeking enhanced privacy. They work by obscuring the origin of funds, making it difficult to trace transactions on the blockchain. As the use of cryptocurrencies grows, so does the need for tools like Bitcoin Mix to ensure secure and confidential transactions.

Features of a Reliable Bitcoin Mixer


Privacy Guarantee: A trustworthy mixer must employ robust no-log policies.
Fast and Efficient: Transactions should be processed without unnecessary delays.
Flexible Options: Users should have control over fees and delays to suit their needs.
Compatibility: Support for various wallet types, including SegWit and bech32.


Why Bitcoin Mix Stands Out

Bitcoin Mix combines cutting-edge technology with user-focused features. From instant transactions to customizable fees, it caters to a wide range of privacy needs. The platforms long-standing reputation since 2017 further solidifies its position as a leading Bitcoin mixer.

Get Started with Bitcoin Mix

Using Bitcoin Mix is simple: specify your receiving wallet, set preferences, and let the service handle the rest. With guaranteed privacy and efficiency, Bitcoin Mix remains a top choice for secure cryptocurrency transactions.

Secure Your Cryptocurrency Transactions Today

Bitcoin Mix offers the ultimate solution for anonymous BTC mixing. Whether youre a seasoned crypto user or new to the world of blockchain, this platform ensures your transactions remain private and secure. Choose Bitcoin Mix for unparalleled confidentiality in 2025.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz