Created
          June 20, 2018 18:42 
        
      - 
      
 - 
        
Save SparK-Cruz/79da1526e0a9c1a44d5ed24bcaf375c2 to your computer and use it in GitHub Desktop.  
    My default curl usage
  
        
  
    
      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
    
  
  
    
  | <?php | |
| trait Requestable { | |
| private function getRequest($url) { | |
| $curl = curl_init(); | |
| curl_setopt($curl, CURLOPT_URL, $url); | |
| curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($curl, CURLOPT_HEADER, false); | |
| try { | |
| return [curl_exec($curl), curl_errno($curl)]; | |
| } finally { | |
| curl_close($curl); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment