3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //unset($_COOKIE['aiepsso']); $userid="aaron.aguirre"; $rut="17317380"; $timestamp=time(); $courseid="null"; $ruta="null"; $sharedSecret="AIEP"; $macParamsString=$courseid.$rut.$ruta.$timestamp.$userid.$sharedSecret; $md5String=md5($macParamsString); $auth=base64_encode($macParamsString);//$md5String); $host="location:https://aieptest.blackboard.com"; $hostV="https://aiepclone.blackboard.com"; $hostVL="location:https://aiepclone.blackboard.com"; $hostT="location:http://localhost:9876"; $autoSignOnURL="/webapps/oslt-auth-provider-autosignon-BBLEARN/service/login/_142_1"; $params="timestamp=".$timestamp."&userId=".$userid."&courseid=".$courseid."&ruta=".$ruta."&rut=".$rut."&auth=".$md5String;//.$auth; $bbURL=$hostV.$autoSignOnURL;//.$params; // header("location:".$bbURL."?".$params); /////////////////////////CURL//////////////////////// /*$curl=curl_init(); $postParameters=array(); $postParameters['timestamp']=$timestamp; $postParameters['userId']=$userid; $postParameters['courseid']=$courseid; $postParameters['ruta']=$ruta; $postParameters['rut']=$rut; $postParameters['auth']=$md5String; curl_setopt($curl,CURLOPT_URL,$bbURL); curl_setopt($curl,CURLOPT_POST,sizeof($postParameters)); curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($postParameters)); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl,CURLOPT_COOKIE, $cookiesIn); curl_setopt($curl,CURLOPT_COOKIEFILE, ""); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); //curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); $result = curl_exec($curl); $header = curl_getinfo( $curl ); $err = curl_errno( $curl ); $errmsg = curl_error( $curl ); curl_close($curl); $header_content = substr($result, 0, $header['header_size']); $postValue=file_get_contents($bbURL); $body_content = trim(str_replace($header_content, '', $result)); $pattern = "#Set-Cookie:\\s+(?<cookie>[^=]+=[^;]+)#m"; preg_match_all($pattern, $header_content, $matches); $cookiesOut = implode("; ", $matches['cookie']); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['headers'] = $header_content; $header['content'] = $body_content; $header['cookies'] = $cookiesOut; $cookiesValue1=explode("=",$matches[cookie][0]); $cookiesValue2=explode("=",$matches[cookie][1]); $cookiesValue3=explode("=",$matches[cookie][2]); $cookiesValue4=explode("=",$matches[cookie][3]); $cookiename1=$cookiesValue1[0]; $cookiename2=$cookiesValue2[0]; $cookiename3=$cookiesValue3[0]; $cookiename4=$cookiesValue4[0]; $cookieValue1=$cookiesValue1[1]; $cookieValue2=$cookiesValue2[1]; $cookieValue3=$cookiesValue3[1]; $cookieValue4=$cookiesValue4[1];*/ /* setcookie($cookiename1,$cookieValue1,0,"/"); setcookie($cookiename2,$cookieValue2,0,"/"); setcookie($cookiename3,$cookieValue3,0,"/"); setcookie($cookiename4,$cookieValue4,0,"/"); */ /* preg_match_all('|Location: (.*)\n|U', $result, $results); $location = implode(';', $results[1]); $realLocationA=$results[1];//implode(";",$location); $realLocation=$realLocationA[2]; setcookie("",$cookiesOut,0,"/",$realLocation);*/ /*setcookie($cookiename1,$cookieValue1,0,"/",$realLocation); setcookie($cookiename2,$cookieValue2,0,"/",$realLocation); setcookie($cookiename3,$cookieValue3,0,"/",$realLocation); setcookie($cookiename4,$cookieValue4,0,"/",$realLocation);*/ //header("Location: $realLocation"); //header("location:".$header['redirect_url']); ////////////////////////////////////////////////////////////////// ///////////////////////////////////////File Get Contents /////////////////////////// /*$curl=curl_init(); $postParameters=array(); $postParameters['timestamp']=$timestamp; $postParameters['userId']=$userid; $postParameters['courseid']=$courseid; $postParameters['ruta']=$ruta; $postParameters['rut']=$rut; $postParameters['auth']=$md5String; curl_setopt($curl,CURLOPT_URL,$bbURL); curl_setopt($curl,CURLOPT_POST,sizeof($postParameters)); curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($postParameters)); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl,CURLOPT_COOKIE, $cookiesIn); curl_setopt($curl,CURLOPT_COOKIEFILE, ""); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); //curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); $result = curl_exec($curl); $header = curl_getinfo( $curl ); $err = curl_errno( $curl ); $errmsg = curl_error( $curl ); curl_close($curl); $authLocation="location:".$header['url']; //print $result; header($authLocation);*/ /* $postdata=http_build_query(array( 'timestamp' => $timestamp, 'userId' => $userid, 'courseid' => $courseid, 'ruta' => $ruta, 'rut' => $rut, 'auth' => $md5String)); $opts=array('https'=>array('method'=>'POST','header'=>"Connection: close\r\n"."Content-Length: ".strlen($postdata)."\r\n",'content'=>$postdata));//$postdata)); $context=stream_context_create($opts); $resultHtml=file_get_contents($bbURL,false,$context); echo $resultHtml;*/ //var_dump($result); //header("location:".$bbURL); //////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////HTTPRequest////////////////////// /* $http = new HttpRequest($bbURL, HttpRequest::METH_POST); $http->addPostFields(array( 'timestamp' => $timestamp, 'userId' => $userid, 'courseid' => $courseid, 'ruta' => $ruta, 'rut' => $rut, 'auth' => $md5String )); $response = $http->send();*/ //////////////////////////////////////////////////////////////// /////////////////////////CURL Less///////////////////////////// /*$data = array('timestamp' => $timestamp, 'userId' => $userid,'courseid' => $courseid,'ruta' => $ruta,'rut' => $rut, 'auth' => $md5String); $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data), ), ); $context = stream_context_create($options); //$result = file_get_contents($bbURL, false, $context); $fp = fopen($bbURL, 'r', false, $context); */ //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////http_post_fields()/////////////////////////// /* $postdata=array( 'timestamp' => $timestamp, 'userId' => $userid, 'courseid' => $courseid, 'ruta' => $ruta, 'rut' => $rut, 'auth' => $md5String); $response=http_post_fields($bbURL,$postdata); */ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////HTTP Request//////////////////////////////////////// $r=new http_request($bbURL); $r->setMethod(HTTP_REQUEST_METHOD_POST); $r->addPostData('timestamp',$timestamp); $r->addPostData('userId',$userid); $r->addPostData('courseid',$courseid); $r->addPostData('ruta',$ruta); $r->addPostData('rut',$rut); $r->addPostData('auth',$md5String); $r->sendRequest(); $page=$r->getResponseBody(); echo $page; ///////////////////////////////////////////////////////////////////////////////////// ?>
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'http_request' not found in /in/FT6qi:203 Stack trace: #0 {main} thrown in /in/FT6qi on line 203
Process exited with code 255.
Output for 5.5.0 - 5.6.24
Fatal error: Class 'http_request' not found in /in/FT6qi on line 203
Process exited with code 255.