3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function get_web_page( $url,$curl_data ) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "GoogleBot", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => 1, // i am sending post data CURLOPT_POSTFIELDS => $curl_data, // this are my post vars CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_VERBOSE => 1 // ); $ch = curl_init($url); curl_setopt_array($ch,$options); $content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch) ; $header = curl_getinfo($ch); curl_close($ch); // $header['errno'] = $err; // $header['errmsg'] = $errmsg; // $header['content'] = $content; return $header; } //curl -d 'o=55000&d=MO&b=2999&h=&w=&l=' http://ems.posindonesia.co.id/ratepiol.php -o JOGMO2999.txt //asal kiriman : $kodepos_asal = "55000"; //variabel kode negara: $ar_kode_neg = array("AE","AF","AG","AL","AM","AO","AR","AT","AU","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO","BR","BS","BT","BW","BY","BZ","CA","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CY","CZ","DE","DJ","DK","DM","DZ","EC","EE","EG","ET","FI","FJ","FR","GA","GB","GD","GH","GM","GN","GR","GU","GW","GY","HK","HN","HR","HT","HU","IE","IL","IN","IQ","IR","IT","JM","JO","JP","KE","KG","KH","KP","KR","KW","KZ","LA","LB","LK","LR","LS","LT","LV","LY","MA","MD","MG","ML","MM","MN","MO","MR","MT","MU","MV","MX","MY","MZ","NA","NC","NE","NF","NL","NO","NP","NR","NZ","OM","PE","PG","PH","PK","PL","PT","PY","QA","RO","RU","RW","SA","SB","SC","SD","SE","SG","SI","SK","SL","SN","SO","SV","SY","SZ","TD","TG","TH","TJ","TL","TM","TN","TO","TR","TV","TW","TZ","UA","UG","US","UY","UZ","VA","VN","WS","YE","YU","ZA","ZM"); //variabel kelompok berat kiriman: $ar_kat_berat = array("250","500","1000","1500","2000","250","500","1000","1500","2000","2500","3000","3500","4000","4500","5000","5500","6000","6500","7000","7500","8000","8500","9000","9500","10000"); $ar_kode_neg = array("AE"); $ar_kat_berat = array("250"); //untuk setiap negara foreach($ar_kode_neg as $kn){ foreach($ar_kat_berat as $kb){ //print $kn."-".$kb; //$commanline = "curl -d 'o=55000&d=".$kn."&b=".$kb."&h=&w=&l=' http://ems.posindonesia.co.id/ratepiol.php -o JOG-".$kn."-".$kb.".txt"; //print $commanline; $curl_data = "o=55000&d=".$kn."&b=".$kb."&h=&w=&l="; $url = "http://ems.posindonesia.co.id/ratepiol.php"; $response = get_web_page($url,$curl_data); print '<pre>'; print_r($response); } } ?>
Output for 7.2.0
Warning: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 5 Warning: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 6 Warning: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 7 Warning: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 8 Warning: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 9 Warning: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 10 Warning: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 11 Warning: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 12 Warning: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 13 Warning: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 14 Warning: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 15 Warning: Use of undefined constant CURLOPT_SSL_VERIFYHOST - assumed 'CURLOPT_SSL_VERIFYHOST' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 16 Warning: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 17 Warning: Use of undefined constant CURLOPT_VERBOSE - assumed 'CURLOPT_VERBOSE' (this will throw an Error in a future version of PHP) in /in/IQOA3 on line 18 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/IQOA3:21 Stack trace: #0 /in/IQOA3(59): get_web_page('http://ems.posi...', 'o=55000&d=AE&b=...') #1 {main} thrown in /in/IQOA3 on line 21
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/IQOA3 on line 5 Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/IQOA3 on line 6 Notice: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' in /in/IQOA3 on line 7 Notice: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /in/IQOA3 on line 8 Notice: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in /in/IQOA3 on line 9 Notice: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' in /in/IQOA3 on line 10 Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /in/IQOA3 on line 11 Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /in/IQOA3 on line 12 Notice: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' in /in/IQOA3 on line 13 Notice: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' in /in/IQOA3 on line 14 Notice: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' in /in/IQOA3 on line 15 Notice: Use of undefined constant CURLOPT_SSL_VERIFYHOST - assumed 'CURLOPT_SSL_VERIFYHOST' in /in/IQOA3 on line 16 Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in /in/IQOA3 on line 17 Notice: Use of undefined constant CURLOPT_VERBOSE - assumed 'CURLOPT_VERBOSE' in /in/IQOA3 on line 18 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/IQOA3:21 Stack trace: #0 /in/IQOA3(59): get_web_page('http://ems.posi...', 'o=55000&d=AE&b=...') #1 {main} thrown in /in/IQOA3 on line 21
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/IQOA3 on line 5 Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/IQOA3 on line 6 Notice: Use of undefined constant CURLOPT_FOLLOWLOCATION - assumed 'CURLOPT_FOLLOWLOCATION' in /in/IQOA3 on line 7 Notice: Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /in/IQOA3 on line 8 Notice: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in /in/IQOA3 on line 9 Notice: Use of undefined constant CURLOPT_AUTOREFERER - assumed 'CURLOPT_AUTOREFERER' in /in/IQOA3 on line 10 Notice: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /in/IQOA3 on line 11 Notice: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /in/IQOA3 on line 12 Notice: Use of undefined constant CURLOPT_MAXREDIRS - assumed 'CURLOPT_MAXREDIRS' in /in/IQOA3 on line 13 Notice: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST' in /in/IQOA3 on line 14 Notice: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS' in /in/IQOA3 on line 15 Notice: Use of undefined constant CURLOPT_SSL_VERIFYHOST - assumed 'CURLOPT_SSL_VERIFYHOST' in /in/IQOA3 on line 16 Notice: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in /in/IQOA3 on line 17 Notice: Use of undefined constant CURLOPT_VERBOSE - assumed 'CURLOPT_VERBOSE' in /in/IQOA3 on line 18 Fatal error: Call to undefined function curl_init() in /in/IQOA3 on line 21
Process exited with code 255.