View difference between Paste ID: rix7MaB3 and R9UBnAXt
SHOW: | | - or go back to the newest paste.
1
<?php
2
function curl($url, $decode = false) {
3
    if($decode == true){
4
        $url = urlencode($url);
5
    }
6
    $ch = curl_init();
7
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
8
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
9
    curl_setopt($ch, CURLOPT_URL, $url);
10
    $result=curl_exec($ch);
11
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
12
    $data = array("content" => $result,"httpcode" => $httpCode, "url" => $url);
13
    return $data;
14
}
15
16
$data = curl('someurl.com');
17
18
$data['content']  // complete source
19
$data['httpcode'] // response code
20
$data['url'] // de url die opgevraagd is