$user, 'client_ip' => $remote_addr ); return do_post_request("http://$wgserver/trusted", $params); } function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'header' => "Content-type: application/x-www-form-urlencoded", #'header'=>"Contrnt-type: application/x-www.form-urlencoded;charset=UTF-8") 'method' => 'POST', 'content' => http_build_query($data) )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } function url($server,$ticket,$view_url){ $params = ':embed=yes&:toolbar=no'; //echo "http://$server/trusted/$ticket/$view_url?$params"; //header("Location: http://$server/trusted/$ticket/$view_url"); //exit(); return "http://$server/trusted/$ticket/$view_url?$params"; } $getticket = get_trusted_ticket($server,$user,$_SERVER['REMOTE_ADDR']); //$getticket = get_trusted_ticket($server,$user,$_SERVER['REMOTE_ADDR']); $geturl = url($server,$getticket,$url); ?>