3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url="http://kakaku.com/camera/camera-lens/itemlist.aspx?pdf_Spec103=13";//取得したいURL $html=file_get_contents($url);//htmlをゴソっと取得 mb_language("Japanese");//エンコードエラー対策 $html=mb_convert_encoding($html,"utf8","auto");//文字コードをUTF-8に変換 $html=preg_replace("/(\n|\r)/","",$html);//改行コードを全部消す preg_match_all('@\<div class=\"ranking\"\>(.*?)\<\/div\>@u',$html,$matches);//配列に入れる foreach($matches[0] as $match){ //商品名 preg_match('@\<a class=\"ckitanker\"\>(.*)\<\/a\>',$match,$product_moto); $product=$product_moto[1]; print '商品名:'.$product.'<br />'; } ?>

preferences:
36.89 ms | 402 KiB | 5 Q