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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.