Jump to content

Array in order to work with the data: beginner question


dilbertone

Recommended Posts

Hello dear friends, hello community,

 

i want to parse a site http://www.aktive-buergerschaft.de/buergerstiftungsfinder

 

Well therefore i have a true beginner-question regarding Array in order to work with the data: beginner question

 

The results should be stored in a MySQL-Database: well you see. i have a Curl-Approach: and i want to work with the parsed data: and in this case i want to give over the data into an array (if viewing the output in web browser, do view-source to see structured array).

 

Here the musings that led to the code:

 

Depending on num dimensions, we could do, foreach($result as $k => $v) {echo $k." ".$v}

to view and work with data (adding sub foreach loops accordingly; i.e. if $v is itself an array)

 

see the results: What do you think:

 

$ch = curl_init("http://www.aktive-buergerschaft.de/buergerstiftungsfinder");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
$buffer = curl_exec($ch);
curl_close($ch);
$result = explode(",", $buffer);
foreach($result as $k => $v) {echo $k." ".$v} 
if $v is itself an array) 
   // print_r($result);

 

look forward to hear  from you!!

 

db1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.