Created
August 16, 2013 12:55
-
-
Save abbotto/6249643 to your computer and use it in GitHub Desktop.
A function to get a files contents with 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
| function file_content($_path) { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. | |
| curl_setopt($ch, CURLOPT_URL, $_path); | |
| $data = curl_exec($ch); | |
| curl_close($ch); | |
| return $data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment