php - echoing request with fputs -


i'm using code below, post request api. debugging purposes: there way echo full request (including header) sent code?

$data = http_build_query($requests);         $url = parse_url($urlfull);         $host = $url['host'];         $path = $url['path'];         $fp = fsockopen('ssl://'.$host, 443, $errno, $errstr, 30);         if ($fp){             fputs($fp, "post $path http/1.1\r\n");             fputs($fp, "host: $host\r\n");             fputs($fp, "pragme: no-cache\r\n");             fputs($fp, "content-length: ". strlen($data) ."\r\n");             fputs($fp, "content-type: application/x-www-form-urlencoded\r\n\r\n");             fputs($fp, $data);             $result = '';             while(!feof($fp)) {                 $result .= fgets($fp, 4096);             }         }         else {          $errors = array(             'status' => 'err',              'error' => "$errstr ($errno)"             );         }         fclose($fp); 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -