ch = curl_init($url); } /* request details */ function rDetails($request_type,$output,$cookie="0",$HTTPS="0",$fields) { if($request_type == 'POST' && $fields != "") { curl_setopt($this->ch,CURLOPT_POSTFIELDS,$fields); } if($request_type == 'GET') { curl_setopt($this->ch,CURLOPT_HTTPGET,1); } if($request_type == 'POST') { curl_setopt($this->ch,CURLOPT_POSTFIELDS,$fields); } if($cookie == 1) { curl_setopt($this->ch,CURLOPT_COOKIEJAR, 'tmp/getcookies.txt'); curl_setopt($this->ch,CURLOPT_COOKIEFILE,'tmp/getcookies.txt'); } if($HTTPS == 1) { curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE); } if($output == 0) { curl_setopt($this->ch,CURLOPT_RETURNTRANSFER, 1); return curl_exec($this->ch); $this->rEnd(); } if($output == 1) { curl_exec($this->ch); $this->rEnd(); } } /* end of request */ function rEnd() { curl_close($this->ch); } /* acronym functions */ function doPOST($url,$fields,$cookies="0",$https="0") { $this->rStart($url); if($cookies == 0) { return $this->rDetails('POST',0,0,$https,$fields); } if($cookies == 1) { return $this->rDetails('POST',0,1,$https,$fields); } function doGET($url,$cookies="0",$https="0") { $this->rStart($url); if($cookies == 0) { return $this->rDetails('GET',0,0,$https,''); } if($cookies == 1) { return $this->rDetails('GET',0,1,$https,''); } } } $istek = new CSA; # $istek->rStart("http://localhost/test/curl.php"); # $istek->rDetails('POST',1,0,'post verisi'); /* GET istek tasi echo $istek->doGET("http://localhost/test/curl.php?a=e",1); GET normal echo $istek->doGET("http://localhost/test/curl.php?a=e",0); HTTPS GET echo $istek->doGET("https://login.yahoo.com/config/login?",1,1); */ echo $istek->doPOST("http://localhost/csa/sample.php","emre=isim&yilmaz=soyad",1,0); ?>