Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 906ef64

Browse files
committed
updated script
1 parent b74c3c7 commit 906ef64

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

‎example.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//echo $res1;
1919
echo '<pre>';
2020
print_r($curl->getInfo());
21+
print_r($res1->getHeaders());
2122
echo '</pre>';
2223

2324

@@ -48,7 +49,8 @@
4849
print_r($curl->getInfo());
4950
echo '</pre>';
5051

51-
52+
// simple HEAD request
53+
$res5 = $curl->head('http://example.com');
5254
echo '<pre>';
53-
print_r($curl->getHeaders('http://example.com'));
55+
print_r($res5->getHeaders());
5456
echo '</pre>';

‎src/Curl.php‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ public function sendRequest($method, $url, $data = array(), $options = array())
8484

8585
case 'head':
8686
$this->httpMethod('head');
87-
$this->options[CURLOPT_HEADER] = true;
8887
$this->options[CURLOPT_NOBODY] = true;
8988
break;
9089

9190
case 'options':
9291
$this->httpMethod('options');
93-
$this->options[CURLOPT_HEADER] = true;
9492
break;
9593

9694
default:
@@ -111,20 +109,6 @@ public function sendRequest($method, $url, $data = array(), $options = array())
111109
return $this->execute();
112110
}
113111

114-
/**
115-
* Get response headers for given URL
116-
* @param string $url
117-
* @param mixed $data
118-
* @param array $options
119-
*/
120-
public function getHeaders($url, $data = array(), $options = array()) {
121-
$headers = array();
122-
if ($res = $this->head($url, $data = array(), $options = array())) {
123-
$headers = $res->getHeaders();
124-
}
125-
return $headers;
126-
}
127-
128112
/**
129113
* Set curl option for request
130114
* @param int|string $option

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /