How to do a GET request on PHP using CURL -


i have simple request trying make , results back. have tried in postman without headers or body , works fine. have put in browser , returns result. but, when in php not getting anything. code looks like. doing wrong?

        $curl = curl_init();          curl_setopt($curl,curlopt_url,'http://********/vizportal/api/web/v1/auth/kerberoslogin');         curl_setopt($curl,curlopt_returntransfer, true);         curl_setopt($curl, curlopt_post, 0);         curl_setopt($curl, curlopt_connecttimeout, '20');          $resp = curl_exec($curl);          echo $resp; 

use header send header browser server :

$curl = curl_init('http://********/vizportal/api/web/v1/auth/kerberoslogin'); curl_setopt($curl, curlopt_post, 0); curl_setopt($curl, curlopt_connecttimeout, '20'); curl_setopt($curl, curlopt_returntransfer, true); //        curl_setopt($curl, curlopt_header, true); //        curl_setopt($curl, curlinfo_header_out, true); // enable tracking  curl_setopt($curl, curlopt_httpheader, array(     'accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',     'accept-encoding:gzip, deflate, sdch',     'accept-language:en-us,en;q=0.6',     'cache-control:max-age=0',     'connection:keep-alive',     'host:www.********.tld ', // example : www.google.com     'referer: http://********/vizportal/api/web/v1/auth/kerberoslogin',     'upgrade-insecure-requests:1',     'user-agent:mozilla/5.0 (windows nt 6.3; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/51.0.2704.106 safari/537.36', ));  $response = curl_exec($curl); curl_close($curl); 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -