更新:virtualeyes(如下)的答案看起来很好:但现在应该应用一点代码清理:
$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);
print_r($result);
经过修正,我们得到了如下内容:
$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);
请参阅virtualeye的其他信息。。。[非常感谢Virtualeye]
yes, print_r just prints out the response,
in this case presumably as an array (if viewing the output in web browser,
do view-source to see structured array).
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)
这里是原问题的旧文本:
today i want to apply Curl on a very simple example that gets a HTTP page - review in order to harvest the data of this pretty simple
see this totally easy page: http://www.aktive-buergerschaft.de/buergerstiftungsfinder here we have a list of Foundations: We can see a bunch (approx 1000 records on Foundations). Well - my intention is to store the data in a locally database (favourite db is MySQL):
这是我的简单方法——缺少两个部分:结果的处理和解析器结果的存储——到MySQL数据库中。这部分有点超出我的想象。
那么,用Curl获取的结果应该给数组——不是吗!?如果有人能在这里帮我,我会很高兴的!
<?php
//
// A very simple example that gets a HTTP page.
//
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://www.aktive-buergerschaft.de/buergerstiftungsfinder");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
// well here i want to put the results into an array... [multidimensioal or not !?! ]
?>
请参阅本页上的示例:(顶部)
Bürgerstiftung Lebensraum Aachen
rechtsfähige Stiftung des bürgerlichen Rechts
Ansprechpartner: Hubert Schramm
Alexanderstr. 69/ 71
52062 Aachen
Telefon: 0241 - 4500130
Telefax: 0241 - 4500131
Email: info@buergerstiftung-aachen.de
www.buergerstiftung-aachen.de
>> Weitere Details zu dieser Stiftung
The link "Weitere Details zu dieser Stiftung" which is: in english More details to this Foundation"
必须遵循此链接,并对结果进行解析。如果你点击链接,你会看到:还有一些额外的信息也应该存储!
好吧,现在需要什么:我需要数组的细节。任何人都可以放大上面可以看到的代码集吗?并给我一个提示!?我期待着。。。