dg_tw_curl_file_get_contents

Simple function to get curl content (json).

Description

dg_tw_curl_file_get_contents( $url ); 

Parameters (1)

0. $url
The url.

Usage

  1. if ( !function_exists( 'dg_tw_curl_file_get_contents' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'twitter-posts-to-blog/functions.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = dg_tw_curl_file_get_contents($url); 
  9.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function dg_tw_curl_file_get_contents($url) { 
  2. $curl = curl_init(); 
  3.  
  4. curl_setopt($curl, CURLOPT_URL, $url); 
  5. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
  6. curl_setopt($curl, CURLOPT_BINARYTRANSFER, true); 
  7. curl_setopt($curl, CURLOPT_TIMEOUT, 12); 
  8.  
  9. $contents = curl_exec($curl); 
  10. curl_close($curl); 
  11. return $contents;