3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $finalurl = "http://www.manta.com/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $finalurl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_HEADER ,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $contents = curl_exec($ch); curl_close($ch); // get cookies $cookies = array(); //var_dump(getallheaders()); preg_match_all('/Set-Cookie:(?<cookie>\s{0,}.*)$/im', $contents, $cookies); $a= $cookies['cookie'][2]; /*echo "<pre>"; print_r($cookies['cookie']);exit;*/ $aa = explode('member_session=',$a); $token = explode(';',$aa[1]); $member_session = $token[0]; $cust= $cookies['cookie'][5]; $cust1 = explode('cust_id=',$cust); $token1 = explode(';',$cust1[1]); $cust_id = $token1[0]; $clientlogin_url = "http://www.manta.com/mb?search=grand+hyatt+new+york+10017&search_source=home"; $clientlogin_post = array( "search" => "grand hyatt new york 10017", "search_source" => "home" ); $headers = array(); $headers[] = "Host:www.manta.com"; $headers[] = "Referer:http://www.manta.com/"; //$headers[] = "X-Requested-With:XMLHttpRequest"; $headers[] = "member_session=".$member_session."; refer_id_persistent=0000; cust_id=".$cust_id.""; //print_r($headers); $curl = curl_init($clientlogin_url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post); //curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); // get cookies //$cookies = array(); //preg_match_all('/Set-Cookie:(?<cookie>\s{0,}.*)$/im', $response, $cookies); // echo $cookies['cookie'][1]; //print_r($cookies['cookie']); echo "<pre>"; print_r($response); ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/qUlYQ:4 Stack trace: #0 {main} thrown in /in/qUlYQ on line 4
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined index: HTTP_USER_AGENT in /in/qUlYQ on line 7 Notice: Undefined index: 2 in /in/qUlYQ on line 19 Warning: explode() expects parameter 2 to be string, null given in /in/qUlYQ on line 22 Warning: explode() expects parameter 2 to be string, null given in /in/qUlYQ on line 23 Notice: Undefined index: 5 in /in/qUlYQ on line 26 Warning: explode() expects parameter 2 to be string, null given in /in/qUlYQ on line 27 Warning: explode() expects parameter 2 to be string, null given in /in/qUlYQ on line 28 <pre>
Output for hhvm-3.10.0
Notice: Undefined index: HTTP_USER_AGENT in /in/qUlYQ on line 7 Notice: Undefined index: 2 in /in/qUlYQ on line 19 Notice: Undefined index: 1 in /in/qUlYQ on line 23 Notice: Undefined index: 5 in /in/qUlYQ on line 26 Notice: Undefined index: 1 in /in/qUlYQ on line 28 <pre>
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/qUlYQ on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/qUlYQ on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/qUlYQ on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/qUlYQ on line 4