Data uit een webadres naar een html formulier

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Dennis Ham

Dennis Ham

05/10/2015 17:51:43
Quote Anchor link
Is het mogelijk om data uit een url te halen die in csv formaat staat en dan in een fromulier in te vullen dmv variables? Ik wil bijvoorbeeld deze data in een webformulier kunnen plaatsen om te bewerken en dan naar mijn database te versturen. Formulier ens heb ik werkend maar vroeg mij af of deze gegevens vanuit een webadres naar mijn reeds bestaande formulier kan zenden

http://data.icecat.biz/xml_s3/xml_server3.cgi?ean_upc=8711500354532,8711500354501;lang=EN;output=productcsv

Dit is de data die ik krijg als ik de bovenstaande link in mijn browser aanvraag:

"Requested_prod_id","Requested_GTIN(EAN/UPC)","Requested_Icecat_id","ErrorMessage","Supplier","Prod_id","Icecat_id","GTIN(EAN/UPC)","Category","CatId","ProductFamily","ProductSeries","Model","Updated","Quality","On_Market","Product_Views","HighPic","HighPic Resolution","LowPic","Pic500x500","ThumbPic","Folder_PDF","Folder_Manual_PDF","ProductTitle","ShortDesc","ShortSummaryDescription","LongSummaryDescription","LongDesc","ProductGallery","ProductGallery Resolution","360","EU Energy Label","EU Product Fiche","PDF","Video/mp4","Other Multimedia","ReasonsToBuy","Spec 1","Spec 2","Spec 3","Spec 4","Spec 5","Spec 6","Spec 7","Spec 8","Spec 9","Spec 10","Spec 11","Spec 12","Spec 13","Spec 14","Spec 15","Spec 16","Spec 17","Spec 18","Spec 19","Spec 20","Spec 21","Spec 22"
"","8711500354532","","","Philips","926000000885","3993245","8711500354532|8711500354549","incandescent bulbs","","","","Standard 40W","20140808190953","ICECAT","1","25415","http://images.icecat.biz/img/norm/high/3993245-7010.jpg","358x358","http://images.icecat.biz/img/norm/low/3993245-7010.jpg","","http://images.icecat.biz/thumbs/3993245.jpg","","","Philips Standard 40W","","Philips Standard 40W","Philips Standard 40W","","http://images.icecat.biz/img/gallery/3993245_1262.jpg|http://images.icecat.biz/img/gallery/3993245_2753.jpg|http://images.icecat.biz/img/gallery/3993245_7559.jpg","2000x1952|1788x871|2000x1416","","","","","","","","Performance","Bulb power: 40 W","Bulb shape: A55","Fitting/cap type: E27","Luminous flux: 415 lm","Bulb lifetime: 1000 h","Light colour: Clear","Type finish: Clear","Colour temperature: 2700 K","Colour of product: Transparent","Dimmable: Yes","Color Rendering Index (CRI): 100","Power","Input voltage: 230","Energy efficiency class: E","Weight & dimensions","Weight: 25 g","Width: 6 cm","Depth: 6 cm","Height: 10 cm","Packaging data","Quantity: 1"
"","8711500354501","","","Philips","354501 84","4135316","8711500354501","incandescent bulbs","","","","Standard 25W E27 230V A55 CL 1CT","20130313153027","ICECAT","","10167","http://images.icecat.biz/img/norm/high/4135316-3882.jpg","326x210","http://images.icecat.biz/img/norm/low/4135316-3882.jpg","","http://images.icecat.biz/thumbs/4135316.jpg","","","Philips Standard 25W E27 230V A55 CL 1CT","","Philips Standard 25W E27 230V A55 CL 1CT","Philips Standard 25W E27 230V A55 CL 1CT","","","","","","","","","","","Performance","Bulb power: 25 W","Fitting/cap type: E27","Luminous flux: 220 lm","Bulb lifetime: 1000 h","Colour temperature: 2700 K","Power","Energy efficiency class: E","Power requirements: 230V","","","","","","","","","","","","",""
Gewijzigd op 05/10/2015 17:54:24 door Dennis Ham
 
PHP hulp

PHP hulp

18/11/2019 20:19:59
 
Frank Nietbelangrijk

Frank Nietbelangrijk

05/10/2015 18:13:48
Quote Anchor link
De url zit achter een login. Mogelijk kan het met curl uitgelezen worden.

Daarna kun je fgetcsv gebruiken
Gewijzigd op 05/10/2015 18:17:37 door Frank Nietbelangrijk
 
Dennis Ham

Dennis Ham

05/10/2015 18:31:09
Quote Anchor link
Ik heb de gebruikersnaam en wachtwoord, hoe gebruik ik curl met deze url?
 
- Ariën -
Beheerder

- Ariën -

05/10/2015 18:36:00
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$username
= "Username";
$password = "Geheim";
$url = "http://www.website.nl/script.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password);
$result = curl_exec($ch);
curl_close($ch);

// de output gaan we nu tonen:
echo $result;
?>
Gewijzigd op 05/10/2015 18:36:12 door - Ariën -
 
Dennis Ham

Dennis Ham

05/10/2015 18:53:07
Quote Anchor link
Wat knap van je Aar, het werkt :D Nu krijg ik alle data zoals in mijn eerste bericht in mijn pagina boven het formulier. Hoe krijg ik nou een waarde bv Requested_GTIN(EAN/UPC) wat 8711500354532 is gekoppeld aan een $var Ik moet een aantal waardes uit deze list halen om in mijn formulier te zetten. Ik denk als ik een er uit kan halen dan komt de rest wel goed ;-)
 
- Ariën -
Beheerder

- Ariën -

05/10/2015 18:58:39
 
Dennis Ham

Dennis Ham

06/10/2015 02:28:19
Quote Anchor link
Ik heb de hele avond van alles geprobeerd op de website die je stuurde maar de enige resultaat die ik krijg is het woordje array zonder verdere data

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
$data
= str_getcsv($result,"\n");

echo $data;
?>
 
Bart V B

Bart V B

06/10/2015 08:02:40
Quote Anchor link
Met alleen array()? dan moet je print_r() gebruiken..
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
$data
= str_getcsv($result,"\n");

print_r($data);
?>
 
Joni Fleischer
Moderator

Joni Fleischer

06/10/2015 08:32:29
Quote Anchor link
Elke komma is gescheiden.

Dus $data is de array.
$data[0]
$data[1]
$data[2]

Dat zijn je variabelen.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.