Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getHttpResponseCode($url) {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, TRUE);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- $status = null;
- $response = curl_exec($ch);
- preg_match_all('(HTTP.*)', $response, $status['http']);
- preg_match_all('(Server:.*)', $response, $status['server']);
- preg_match_all('(X-Powered-By:.*)', $response, $status['X-Powered-By']);
- return $status;
- }
- $x = (getHttpResponseCode("http://google.com.br"));
- print_r($x['http'][0][0]);
- print_r($x['server'][0][0]);
- print_r($x['X-Powered-By'][0][0]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement