access specific or all php curl get request headers and post ajax request -
i need specific headers of http request m making.i have set curlopt_header_out option it's still not showing request headers. m not getting positive response of request. response 504 gateway timeout. though requests made google chrome successful. m pretty sure http headers m sending correct. can't figure out problem.
<?php $tmatch=array(); function initialize_curl($url,$file){ $ch = curl_init(); curl_setopt($ch, curlopt_header, true); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch,curlopt_url, $url); curl_setopt($ch,curlopt_post, true); curl_setopt($ch,curlopt_postfields, "emailid=anything&password=anything&placement=login pop-up homepage&pp=1&utmfullstring=pp=1"); curl_setopt($ch, curlopt_cookiejar, 'cookie.txt'); curl_setopt($ch, curlopt_cookiefile, 'cookie.txt'); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_httpheader, array('content-type: text/html','accept:application/json, text/javascript, */*; q=0.01','accept-encoding:gzip, deflate, br','accept-language:en-us,en;q=0.8','content-length:124','content-type:application/json; charset=utf-8','cookie:user-preference=1; ajs_anonymous_id=%221bdc466a-a437-42b6-9ff3-537744a2903c%22; km_lv=x; __utma=103409237.377015625.1478324293.1478359407.1478367793.5; __utmz=103409237.1478324294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _ceg.s=og6jw0; _ceg.u=og6jw0; km_ai=1236193; km_ni=1236193; pnctest=1; __utmt=1; connect.sid=s%3atbsx1o-pbsheuyz12dg41p9pxtuzmkvq.fzkconovwiblqestff7rh0d3rtiiqtysbj4xc%2bm4kdg; _ga=ga1.2.377015625.1478324293; ajs_user_id=%221236193%22; ajs_group_id=null; __utma=80796416.377015625.1478324293.1478616536.1478770084.14; __utmb=80796416.3.9.1478770085823; __utmc=80796416; __utmz=80796416.1478367798.4.3.utmcsr=dream11.com|utmccn=(referral)|utmcmd=referral|utmcct=/; _ceg.s=ogf6ay; _ceg.u=ogf6ay; _we_wk_ss_lsf_=true; __utmli=m_txtemailid; kvcd=1478770092725; km_vs=1','origin:https://fantasycricket.dream11.com','referer:https://fantasycricket.dream11.com/in/?pp=1','user-agent:mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/54.0.2840.71 safari/537.36','x-requested-with:xmlhttprequest')); curl_setopt($ch, curlopt_useragent, "mozillaxyz/1.0"); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlinfo_header_out, true); curl_setopt($ch, curlopt_maxredirs, 10 ); //$fp = fopen($file, "w"); //curl_setopt($ch, curlopt_file, $fp); //$document = new domdocument("1.0", "utf-8"); //$document->preservewhitespace = false; //var_dump(curl_getinfo($ch)); $response=curl_exec($ch); //@$document->loadhtmlfile($file); //svar_dump($response); if($response!=null) print (htmlentities($response)); else echo("hahaha...idiot."); //echo(curl_getinfo($ch)); //$response=explode("\r\n\r\n", $response); //$ind=count($response)-1; //fclose($fp); $curlob=array($ch); return $curlob; } //echo($response[$ind]); $sched=initialize_curl("https://fantasycricket.dream11.com/in/registration/login","example_homepage.html"); ?>
this response getting:
http/1.1 504 gateway_timeout content-length: 0 connection: keep-alive date: thu, 10 nov 2016 10:06:23 gmt x-cache: error cloudfront via: 1.1 14f71fe5c8de222bc3e6156da469123a.cloudfront.net (cloudfront) x-amz-cf-id: xppzjjt8m5egnwpwckikel7gmvlk7xcse3q_kp_7ov6bwhqh1pjcsq==
Comments
Post a Comment