Last active
June 29, 2016 14:54
-
-
Save rodrigograca31/02715a89dc5dd840a75a to your computer and use it in GitHub Desktop.
PHP CURL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//From: http://php.net/manual/en/function.curl-exec.php | |
// create curl resource | |
$ch = curl_init(); | |
// set url | |
curl_setopt($ch, CURLOPT_URL, "example.com"); | |
//return the transfer as a string | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
//stop caching | |
$header = array("Cache-Control: no-cache"); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); | |
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE); | |
// $output contains the output string | |
$output = curl_exec($ch); | |
// close curl resource to free up system resources | |
curl_close($ch); | |
var_dump($output); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment