3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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\> \<span class=\"price\"\>@u',$match,$product_moto); $product=$product_moto[1]; print '商品名:'.$product.'<br />'; } ?>
based on DnscN
Output for 5.3.19 - 5.4.45, 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.2.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/QNMUD on line 4 Warning: file_get_contents(http://kakaku.com/camera/camera-lens/itemlist.aspx?pdf_Spec103=13): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/QNMUD on line 4
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/QNMUD on line 4 Warning: file_get_contents(http://kakaku.com/camera/camera-lens/itemlist.aspx?pdf_Spec103=13): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/QNMUD on line 4