Anonymní profil JM – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil JM – Programujte.comAnonymní profil JM – Programujte.com

 

Příspěvky odeslané z IP adresy 213.81.192.–

JM
PHP › export dat z csv do xml pouz…
25. 6. 2020   #386294

#3 MilanL
nechcem aby mi tu niekto robil kod ale poradil. Dakujem za postup ktory si mi napisal. Taky isty som nasiel na google a viem ze mam pouzit google.

JM
PHP › export dat z csv do xml pouz…
25. 6. 2020   #386293

#2 Kit
mam nieco taketo ale neviem ci to je dobre:


<?php
    $delimit = "," ;       
    $row_count = 0 ;
    $inputFilename = "data.csv" ;
 
    $outputFilename   = 'export.xml';
 
foreach ($tsvFile as $line => $row) {
if($line > 0 && $line !== ' ') {
    $xmlWriter->startElement('item');
            $xmlWriter->writeElement('id', $row[0]);
            $xmlWriter->writeElement('meno', $row[0]);
            $xmlWriter->writeElement('psc', $row[0]);
            $xmlWriter->writeElement('krajina', $row[1]);
            $xmlWriter->writeElement('tel', $row[2]);
            $xmlWriter->writeElement('sms', $row[2]);
            $xmlWriter->endElement();
    }
}
$xmlWriter->endElement();
$xmlWriter->endDocument();
?>
 
 

JM
PHP › export dat z csv do xml pouz…
25. 6. 2020   #386289

Zdravim,

Prosim o pomoc s touto ulohou:

Mam .csv subor: 

“ID”; “meno”;”psc”;”krajina”;”tel”;”sms!

1;”peto@”;”012 22”;”SK”;910111111;”ano”

2;”marek16”;1212;”Slovensko”;00421910112555;”nie”

3.;”janco”;99999;”CZ”;”-“;

ktory mam vyexportovat do xml suboru pouzitim PHP.

XML subor by mal vyzerat asi takto:

<order>

<id></id>

<meno></meno>

<psc></psc>

<krajina></krajina>

<tel></tel>

<sms></sms>

</order>

Dakujem za kazdu pomoc

Python › Úloha python ako na to
21. 8. 2019   #384142

Dostal som ulohu a poprosil by som Vas o pomoc ako na to, vopred velmi pekne dakujem. Tu je ta uloha:

Webscrapingstránkyhttps://pin-up.bet/, športTenis (odporúčampoužiťknižnicu requests a json).

Načítanie ID zápasov

import requests

import json

burp0_url = "https://sport.pin-up.bet:443/InPlay/GetEventsList"

burp0_cookies = {"__cfduid": "dff203d9ffe7cb9f07101c0fbf0ca23511562058910", "iOSFix": "sport.pin-up.bet", "_ga": "GA1.2.1012685747.1562058910", "_gid": "GA1.2.1444933814.1562058910", "_gat": "1", "ASP.NET_SesssionId": "jkcaaod55pqmocuxodrcefxi", "__cfruid": "4f5c6f69863ee1f7c6af549797383c6e11ba1cf3-1562066642", "_gat_gtag_UA_106090315_1": "1", "_gat_gtag_UA_133587723_1": "1"}

burp0_headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "https://sport.pin-up.bet/SportsBook/EventView/5125087?game=Facundo-Bagnis-Laurynas-Grigelis", "Content-Type": "application/json; charset=utf-8", "X-Requested-With": "XMLHttpRequest", "Connection": "close"}

burp0_json={"langId": 2, "partnerId": 65, "sportId": 3, "stTypes": [1, 702, 2, 3, 37]}

web_data = requests.post(burp0_url, headers=burp0_headers, cookies=burp0_cookies, json=burp0_json).json()
print(web_data)

Načítanie každého zápasu.

array_of_players = ???
forplayer_id in array_of_players:
    #get allpages

import requests

import json

burp0_url = "https://sport.pin-up.bet:443/InPlay/GetEventStakes"

burp0_cookies = {"__cfduid": "dff203d9ffe7cb9f07101c0fbf0ca23511562058910", "iOSFix": "sport.pin-up.bet", "_ga": "GA1.2.1012685747.1562058910", "_gid": "GA1.2.1444933814.1562058910", "_gat": "1", "ASP.NET_SesssionId": "jkcaaod55pqmocuxodrcefxi", "__cfruid": "4f5c6f69863ee1f7c6af549797383c6e11ba1cf3-1562066642", "_gat_gtag_UA_106090315_1": "1", "_gat_gtag_UA_133587723_1": "1"}

burp0_headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "https://sport.pin-up.bet/SportsBook/EventView/5125087?game=Facundo-Bagnis-Laurynas-Grigelis", "Content-Type": "application/json; charset=utf-8", "X-Requested-With": "XMLHttpRequest", "Connection": "close"}

burp0_json={"eventNumber": EVENT_ID, "langId": 2, "partnerId": 65}

event_id = requests.post(burp0_url, headers=burp0_headers, cookies=burp0_cookies, json=burp0_json).json()
print(event_id)

Zo stránokzápasovuložnasledujúce data – menáhráčov, kurzynavíťazazápasu, kurzynavýťazaaktuálnehosetu a všetkýchnasledujúcich,  kurzynavýťazaaktuálnehogemu a všetkýchnasledujúcich.

Vzorovývýstup - [{'Name': 'Jan-Lennard Struff - Matteo Berrettini', 'Events': {'MatchWinner': {'1': 1.93, '2': 1.77}, '1. SetWinner': {'1': 1.95, '2': 1.75}, '1. GameWinner': {'1': 1.07, '2': 6.8}, '2. GameWinner': {'1': 7.2, '2': 1.06}}, 'web_scrape': 'Betrally'}, {'Name': 'Alison Riske - Veronika Kudermetova', 'Events': {'MatchWinner': {'1': 1.41, '2': 2.69}, '6. GameWinner': {'1': 4.7, '2': 1.15}, '7. GameWinner': {'1': 1.23, '2': 3.7}}, 'web_scrape': 'Betrally'}, {'Name': 'Tatjana Maria - Donna Vekic', 'Events': {'MatchWinner': {'1': 3.55, '2': 1.25}, '1. SetWinner': {'1': 2.88, '2': 1.36}, '1. GameWinner': {'1': 2.88, '2': 1.36}, '2. GameWinner': {'1': 1.63, '2': 2.14}}, 'web_scrape': 'Betrally'}, {'Name': 'Alexander Bublik - Jack Draper', 'Events': {'MatchWinner': {'1': 1.1, '2': 5.8}, '3. GameWinner': {'1': 1.03, '2': 9.0}, '4. GameWinner': {'1': 3.7, '2': 1.23}}, 'web_scrape': 'Betrally'}, {'Name': 'Joao Sousa - Jannik Sinner', 'Events': {'MatchWinner': {'1': 1.61, '2': 2.17}, '4. GameWinner': {'1': 8.4, '2': 1.04}, '5. GameWinner': {'1': 1.2, '2': 4.0}}, 'web_scrape': 'Betrally'}]

 

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý