Title: functions.php &#8211; what does this code do?
Last modified: August 19, 2016

---

# functions.php – what does this code do?

 *  [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/functionsphp-what-does-this-code-do/)
 * Hi there,
 * I am updating a site for someone and in functions.php I found this code that 
   doesn’t appear to do anything. Can anyone tell me it’s purpose?
 * ‘
    function get_data($url){ $ch = curl_init(); $timeout = 5; curl_setopt($ch,
   CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,
   CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return
   $data; } ‘
 * Many thanks,
    Fiona

Viewing 1 replies (of 1 total)

 *  [Gerald Yeo](https://wordpress.org/support/users/geraldyeo/)
 * (@geraldyeo)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/functionsphp-what-does-this-code-do/#post-1328231)
 * This function uses the PHP CURL Library to fetch data from another site..
 * A possibly use would be using it to fetch the JSON/XML response from tinyurl.
 * It uses the CURL php library. For more information: [http://php.net/manual/en/book.curl.php](http://php.net/manual/en/book.curl.php)

Viewing 1 replies (of 1 total)

The topic ‘functions.php – what does this code do?’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)

 * 1 reply
 * 2 participants
 * Last reply from: [Gerald Yeo](https://wordpress.org/support/users/geraldyeo/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/functionsphp-what-does-this-code-do/#post-1328231)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
