Page 1 of 1

Array in order to work with the data: beginner question

Posted: Sun May 22, 2011 2:39 pm
by lin
Hello dear friends,

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

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:

Code: Select all

$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!!

lin

Re: Array in order to work with the data: beginner question

Posted: Mon May 23, 2011 10:44 am
by Jonah Bron
When you say "parse" that site, do you mean you want to extract the (apparently) locations from that page?

Re: Array in order to work with the data: beginner question

Posted: Tue May 24, 2011 3:32 pm
by lin
hello Jonah


Jonah Bron wrote:When you say "parse" that site, do you mean you want to extract the (apparently) locations from that page?
yup - any way to do this with php !?