From 5dc0822f7d3c7245eda7d51df9837c769250ccb0 Mon Sep 17 00:00:00 2001 From: "Sebastian M. Alvarez" Date: Sun, 25 Mar 2012 14:56:22 -0300 Subject: [PATCH 1/2] Added debug support --- lib/curl.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/curl.php b/lib/curl.php index 9d9497f..3d9fea4 100644 --- a/lib/curl.php +++ b/lib/curl.php @@ -67,6 +67,13 @@ class Curl { * @access protected **/ protected $request; + + /** + * Sets curl_setopt($curl, CURLOPT_VERBOSE, 1); + * @var boolean + * @access public + **/ + public $debug = false; /** * Initializes a Curl object @@ -169,10 +176,12 @@ function request($method, $url, $vars = array()) { $this->error = ''; $this->request = curl_init(); if (is_array($vars)) $vars = http_build_query($vars, '', '&'); - + $this->set_request_method($method); $this->set_request_options($url, $vars); $this->set_request_headers(); + + if($this->debug) curl_setopt($this->request, CURLOPT_VERBOSE, 1); $response = curl_exec($this->request); From 40530baeea7580268b9593f74c9c4adf64edde7a Mon Sep 17 00:00:00 2001 From: charly22 Date: Fri, 25 Jul 2014 12:14:13 -0300 Subject: [PATCH 2/2] print sent data when debug is enabled --- lib/curl.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/curl.php b/lib/curl.php index 3d9fea4..789511a 100644 --- a/lib/curl.php +++ b/lib/curl.php @@ -181,7 +181,10 @@ function request($method, $url, $vars = array()) { $this->set_request_options($url, $vars); $this->set_request_headers(); - if($this->debug) curl_setopt($this->request, CURLOPT_VERBOSE, 1); + if($this->debug) { + curl_setopt($this->request, CURLOPT_VERBOSE, 1); + echo "\n$vars\n"; + } $response = curl_exec($this->request);