Skip to content

Instantly share code, notes, and snippets.

@avdg
Forked from Ttech/curl_get_contents.php
Created April 7, 2011 20:59
Show Gist options
  • Select an option

  • Save avdg/908701 to your computer and use it in GitHub Desktop.

Select an option

Save avdg/908701 to your computer and use it in GitHub Desktop.

Revisions

  1. avdg revised this gist Apr 7, 2011. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -11,21 +11,21 @@ function curl_get_contents($url, $timeout = 30, $settings_array = array())
    );
    // We assume nobody's going to try to overwrite the settings above
    array_merge($curl_options,$settings_array);
    if(!$curl_open = curl_init()){
    if (!$curl_open = curl_init()) {
    $return = false;
    }
    curl_setopt_array($curl_open, $curl_options);
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    } elseif (function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url; // Set up command

    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();

    if($status > 1) {
    if ($status > 1) {
    return false;
    }
    }
  2. avdg revised this gist Apr 7, 2011. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    <?php
    function curl_get_contents($url, $timeout = 30, $settings_array = array())
    {
    $return false;
    if (function_exists("curl_init")) {
    $curl_options = array(
    CURLOPT_URL => $url,
    @@ -27,8 +28,6 @@ function curl_get_contents($url, $timeout = 30, $settings_array = array())
    if($status > 1) {
    return false;
    }
    } else {
    return false;
    }
    return $return;
    }
  3. avdg revised this gist Apr 7, 2011. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -17,17 +17,18 @@ function curl_get_contents($url, $timeout = 30, $settings_array = array())
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    $cmd = "curl -m $timeout -s-url ".$url; // Set up command

    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();

    if($status > 1) {
    return false;
    }
    } else {
    return false;
    }
    return $return;
    }
    ?>
    }
  4. avdg revised this gist Apr 7, 2011. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php
    function curl_get_contents($url,$timeout=30,$settings_array=array())
    function curl_get_contents($url, $timeout = 30, $settings_array = array())
    {
    if(function_exists("curl_init")){
    if (function_exists("curl_init")) {
    $curl_options = array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    @@ -23,10 +23,10 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
    return false;
    }
    } else {
    $return = false;
    return false;
    }
    return $return;
    }
  5. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    ob_start();
    passthru($cmd, $status); // Run command
    return ob_get_contents(); // Put everything into the variable
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
  6. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -11,10 +11,10 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    // We assume nobody's going to try to overwrite the settings above
    array_merge($curl_options,$settings_array);
    if(!$curl_open = curl_init()){
    return false;
    $return = false;
    }
    curl_setopt_array($curl_open, $curl_options);
    return curl_exec($curl_open);
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    @@ -23,8 +23,11 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    return ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    return false;
    $return = false;
    }
    } else {
    $return = false;
    }
    return $return;
    }
    ?>
  7. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -25,8 +25,6 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    if($status > 1) {
    return false;
    }
    } else {
    return false;
    }
    }
    ?>
  8. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,6 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    echo $cmd;
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    return ob_get_contents(); // Put everything into the variable
  9. @Ttech Ttech revised this gist Apr 7, 2011. 3 changed files with 5 additions and 127 deletions.
    82 changes: 0 additions & 82 deletions changes.diff
    Original file line number Diff line number Diff line change
    @@ -1,82 +0,0 @@
    2,5c2,34
    < function curl_get_contents($file, $timeout=30, $settings_array=FAlSE) {
    < if(function_exists('curl_init')) {
    < if(!$curl_open = curl_init()) {
    < trigger_error("Failed to start CURL", E_USER_ERROR);
    ---
    > function curl_get_contents($url,$timeout=30,$settings_array=false)
    > {
    > if(function_exists("curl_init")){
    > $curl_options = array(
    > CURLOPT_URL => $url,
    > CURLOPT_RETURNTRANSFER => true,
    > CURLOPT_TIMEOUT => intval($timeout),
    > CURLOPT_HEADER => false
    > );
    > // We assume nobody's going to try to overwrite the settings above
    > if(is_array($settings_array)){
    > array_merge($curl_options,$settings_array);
    > }
    > if(!$curl_open = curl_init()){
    > $return = false;
    > }
    > curl_setopt_array($curl_open, $curl_options);
    > $return = curl_exec($curl_open);
    > curl_close($curl_open); // Close CURL
    > } elseif(function_exists("passthru")) {
    > $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    > echo $cmd;
    > /* The only way I could get a correctly formated file into a variable */
    > ob_start();
    > passthru($cmd, $status); // Run command
    > $return = ob_get_contents(); // Put everything into the variable
    > ob_end_clean();
    > if($status > 1) {
    > $return = false;
    > }
    > } else {
    > trigger_error("Unable to run cURL", E_USER_ERROR);
    > $return = false;
    7,45c36,37
    <
    < curl_setopt($curl_open, CURLOPT_URL, $file); // Set URL
    < curl_setopt($curl_open, CURLOPT_RETURNTRANSFER, TRUE);
    < curl_setopt($curl_open, CURLOPT_TIMEOUT, intval($timeout));
    < curl_setopt($curl_open, CURLOPT_HEADER, FALSE);
    < curl_setopt($curl_open, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    <
    < /* Let the user set extra options if they want to */
    < if($settings_array == TRUE && (is_array($settings_array))) {
    < $pre_set(CURLOPT_URL, CURLOPT_RETURNTRANSFER, CURLOPT_TIMEOUT, CURLOPT_HEADER, CURLOPT_USERAGENT);
    < foreach($settings_array as $setting => $value){
    < /* Remove any options that were already set */
    < if(!isset($pre_set[$setting])) {
    < if(!curl_setopt($curl_open, $setting, $value)) {
    < trigger_error("Could not set "$setting"", E_USER_WARNING); // The script may still work, so lets just try
    < }
    < }
    < }
    < }
    < $ret = curl_exec($curl_open); // Open the URL and put the contents into $ret
    < curl_close($curl_open); // Close CURL
    < } elseif(function_exists('passthru') && (stristr($_SERVER['SERVER_SOFTWARE'], "nix"))) {
    <
    < $cmd = "curl -m ".$timeout." -A "".$_SERVER['HTTP_USER_AGENT']."" -url ".$file.""; // Set up command
    < /* The only way I could get a correctly formated file into a variable */
    < ob_start();
    < passthru($cmd, $status); // Run command
    < $ret = ob_get_contents(); // Put everything into the variable
    < ob_end_clean();
    < if(isset($status) && ($status> 1)) {
    < trigger_error("Bad command line arguments", E_USER_WARNING); // The script may still work, so lets just try
    < }
    < } else {
    < /* If the CURL extention and the command line CURL are not found */
    < trigger_error("Could not find or run CURL", E_USER_ERROR);
    < exit; // If the script is not already stopped, stop the script now since we can't really do anything
    < }
    < /* If everything worked correctly return the URL contents */
    < return $ret;
    ---
    > return $return; // Why???
    > }
    38 changes: 0 additions & 38 deletions curl1.php
    Original file line number Diff line number Diff line change
    @@ -1,38 +0,0 @@
    <?php
    function curl_get_contents($url,$timeout=30,$settings_array=false)
    {
    if(function_exists("curl_init")){
    $curl_options = array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => intval($timeout),
    CURLOPT_HEADER => false
    );
    // We assume nobody's going to try to overwrite the settings above
    if(is_array($settings_array)){
    array_merge($curl_options,$settings_array);
    }
    if(!$curl_open = curl_init()){
    $return = false;
    }
    curl_setopt_array($curl_open, $curl_options);
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    echo $cmd;
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
    }
    } else {
    trigger_error("Unable to run cURL", E_USER_ERROR);
    $return = false;
    }
    return $return; // Why???
    }
    ?>
    12 changes: 5 additions & 7 deletions curl0.php → curl_get_contents.php
    Original file line number Diff line number Diff line change
    @@ -11,26 +11,24 @@ function curl_get_contents($url,$timeout=30,$settings_array=array())
    // We assume nobody's going to try to overwrite the settings above
    array_merge($curl_options,$settings_array);
    if(!$curl_open = curl_init()){
    $return = false;
    return false;
    }
    curl_setopt_array($curl_open, $curl_options);
    $return = curl_exec($curl_open);
    return curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    echo $cmd;
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    return ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
    return false;
    }
    } else {
    trigger_error("Unable to run cURL", E_USER_ERROR);
    $return = false;
    return false;
    }
    return $return; // Why???
    }
    ?>
  10. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions curl0.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    <?php
    function curl_get_contents($url,$timeout=30,$settings_array=false)
    function curl_get_contents($url,$timeout=30,$settings_array=array())
    {
    if(function_exists("curl_init")){
    $curl_options = array(
    @@ -9,9 +9,7 @@ function curl_get_contents($url,$timeout=30,$settings_array=false)
    CURLOPT_HEADER => false
    );
    // We assume nobody's going to try to overwrite the settings above
    if(is_array($settings_array)){
    array_merge($curl_options,$settings_array);
    }
    array_merge($curl_options,$settings_array);
    if(!$curl_open = curl_init()){
    $return = false;
    }
  11. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 82 additions and 0 deletions.
    82 changes: 82 additions & 0 deletions changes.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,82 @@
    2,5c2,34
    < function curl_get_contents($file, $timeout=30, $settings_array=FAlSE) {
    < if(function_exists('curl_init')) {
    < if(!$curl_open = curl_init()) {
    < trigger_error("Failed to start CURL", E_USER_ERROR);
    ---
    > function curl_get_contents($url,$timeout=30,$settings_array=false)
    > {
    > if(function_exists("curl_init")){
    > $curl_options = array(
    > CURLOPT_URL => $url,
    > CURLOPT_RETURNTRANSFER => true,
    > CURLOPT_TIMEOUT => intval($timeout),
    > CURLOPT_HEADER => false
    > );
    > // We assume nobody's going to try to overwrite the settings above
    > if(is_array($settings_array)){
    > array_merge($curl_options,$settings_array);
    > }
    > if(!$curl_open = curl_init()){
    > $return = false;
    > }
    > curl_setopt_array($curl_open, $curl_options);
    > $return = curl_exec($curl_open);
    > curl_close($curl_open); // Close CURL
    > } elseif(function_exists("passthru")) {
    > $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    > echo $cmd;
    > /* The only way I could get a correctly formated file into a variable */
    > ob_start();
    > passthru($cmd, $status); // Run command
    > $return = ob_get_contents(); // Put everything into the variable
    > ob_end_clean();
    > if($status > 1) {
    > $return = false;
    > }
    > } else {
    > trigger_error("Unable to run cURL", E_USER_ERROR);
    > $return = false;
    7,45c36,37
    <
    < curl_setopt($curl_open, CURLOPT_URL, $file); // Set URL
    < curl_setopt($curl_open, CURLOPT_RETURNTRANSFER, TRUE);
    < curl_setopt($curl_open, CURLOPT_TIMEOUT, intval($timeout));
    < curl_setopt($curl_open, CURLOPT_HEADER, FALSE);
    < curl_setopt($curl_open, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    <
    < /* Let the user set extra options if they want to */
    < if($settings_array == TRUE && (is_array($settings_array))) {
    < $pre_set(CURLOPT_URL, CURLOPT_RETURNTRANSFER, CURLOPT_TIMEOUT, CURLOPT_HEADER, CURLOPT_USERAGENT);
    < foreach($settings_array as $setting => $value){
    < /* Remove any options that were already set */
    < if(!isset($pre_set[$setting])) {
    < if(!curl_setopt($curl_open, $setting, $value)) {
    < trigger_error("Could not set "$setting"", E_USER_WARNING); // The script may still work, so lets just try
    < }
    < }
    < }
    < }
    < $ret = curl_exec($curl_open); // Open the URL and put the contents into $ret
    < curl_close($curl_open); // Close CURL
    < } elseif(function_exists('passthru') && (stristr($_SERVER['SERVER_SOFTWARE'], "nix"))) {
    <
    < $cmd = "curl -m ".$timeout." -A "".$_SERVER['HTTP_USER_AGENT']."" -url ".$file.""; // Set up command
    < /* The only way I could get a correctly formated file into a variable */
    < ob_start();
    < passthru($cmd, $status); // Run command
    < $ret = ob_get_contents(); // Put everything into the variable
    < ob_end_clean();
    < if(isset($status) && ($status> 1)) {
    < trigger_error("Bad command line arguments", E_USER_WARNING); // The script may still work, so lets just try
    < }
    < } else {
    < /* If the CURL extention and the command line CURL are not found */
    < trigger_error("Could not find or run CURL", E_USER_ERROR);
    < exit; // If the script is not already stopped, stop the script now since we can't really do anything
    < }
    < /* If everything worked correctly return the URL contents */
    < return $ret;
    ---
    > return $return; // Why???
    > }
  12. @Ttech Ttech revised this gist Apr 7, 2011. 1 changed file with 35 additions and 43 deletions.
    78 changes: 35 additions & 43 deletions curl0.php
    Original file line number Diff line number Diff line change
    @@ -1,46 +1,38 @@
    <?php
    function curl_get_contents($file, $timeout=30, $settings_array=FAlSE) {
    if(function_exists('curl_init')) {
    if(!$curl_open = curl_init()) {
    trigger_error("Failed to start CURL", E_USER_ERROR);
    function curl_get_contents($url,$timeout=30,$settings_array=false)
    {
    if(function_exists("curl_init")){
    $curl_options = array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => intval($timeout),
    CURLOPT_HEADER => false
    );
    // We assume nobody's going to try to overwrite the settings above
    if(is_array($settings_array)){
    array_merge($curl_options,$settings_array);
    }
    if(!$curl_open = curl_init()){
    $return = false;
    }
    curl_setopt_array($curl_open, $curl_options);
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    echo $cmd;
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
    }
    } else {
    trigger_error("Unable to run cURL", E_USER_ERROR);
    $return = false;
    }

    curl_setopt($curl_open, CURLOPT_URL, $file); // Set URL
    curl_setopt($curl_open, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl_open, CURLOPT_TIMEOUT, intval($timeout));
    curl_setopt($curl_open, CURLOPT_HEADER, FALSE);
    curl_setopt($curl_open, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

    /* Let the user set extra options if they want to */
    if($settings_array == TRUE && (is_array($settings_array))) {
    $pre_set(CURLOPT_URL, CURLOPT_RETURNTRANSFER, CURLOPT_TIMEOUT, CURLOPT_HEADER, CURLOPT_USERAGENT);
    foreach($settings_array as $setting => $value){
    /* Remove any options that were already set */
    if(!isset($pre_set[$setting])) {
    if(!curl_setopt($curl_open, $setting, $value)) {
    trigger_error("Could not set "$setting"", E_USER_WARNING); // The script may still work, so lets just try
    }
    }
    }
    }
    $ret = curl_exec($curl_open); // Open the URL and put the contents into $ret
    curl_close($curl_open); // Close CURL
    } elseif(function_exists('passthru') && (stristr($_SERVER['SERVER_SOFTWARE'], "nix"))) {

    $cmd = "curl -m ".$timeout." -A "".$_SERVER['HTTP_USER_AGENT']."" -url ".$file.""; // Set up command
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $ret = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if(isset($status) && ($status> 1)) {
    trigger_error("Bad command line arguments", E_USER_WARNING); // The script may still work, so lets just try
    }
    } else {
    /* If the CURL extention and the command line CURL are not found */
    trigger_error("Could not find or run CURL", E_USER_ERROR);
    exit; // If the script is not already stopped, stop the script now since we can't really do anything
    }
    /* If everything worked correctly return the URL contents */
    return $ret;
    return $return; // Why???
    }
    ?>
  13. @Ttech Ttech created this gist Apr 7, 2011.
    46 changes: 46 additions & 0 deletions curl0.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    <?php
    function curl_get_contents($file, $timeout=30, $settings_array=FAlSE) {
    if(function_exists('curl_init')) {
    if(!$curl_open = curl_init()) {
    trigger_error("Failed to start CURL", E_USER_ERROR);
    }

    curl_setopt($curl_open, CURLOPT_URL, $file); // Set URL
    curl_setopt($curl_open, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl_open, CURLOPT_TIMEOUT, intval($timeout));
    curl_setopt($curl_open, CURLOPT_HEADER, FALSE);
    curl_setopt($curl_open, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

    /* Let the user set extra options if they want to */
    if($settings_array == TRUE && (is_array($settings_array))) {
    $pre_set(CURLOPT_URL, CURLOPT_RETURNTRANSFER, CURLOPT_TIMEOUT, CURLOPT_HEADER, CURLOPT_USERAGENT);
    foreach($settings_array as $setting => $value){
    /* Remove any options that were already set */
    if(!isset($pre_set[$setting])) {
    if(!curl_setopt($curl_open, $setting, $value)) {
    trigger_error("Could not set "$setting"", E_USER_WARNING); // The script may still work, so lets just try
    }
    }
    }
    }
    $ret = curl_exec($curl_open); // Open the URL and put the contents into $ret
    curl_close($curl_open); // Close CURL
    } elseif(function_exists('passthru') && (stristr($_SERVER['SERVER_SOFTWARE'], "nix"))) {

    $cmd = "curl -m ".$timeout." -A "".$_SERVER['HTTP_USER_AGENT']."" -url ".$file.""; // Set up command
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $ret = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if(isset($status) && ($status> 1)) {
    trigger_error("Bad command line arguments", E_USER_WARNING); // The script may still work, so lets just try
    }
    } else {
    /* If the CURL extention and the command line CURL are not found */
    trigger_error("Could not find or run CURL", E_USER_ERROR);
    exit; // If the script is not already stopped, stop the script now since we can't really do anything
    }
    /* If everything worked correctly return the URL contents */
    return $ret;
    ?>
    38 changes: 38 additions & 0 deletions curl1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <?php
    function curl_get_contents($url,$timeout=30,$settings_array=false)
    {
    if(function_exists("curl_init")){
    $curl_options = array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => intval($timeout),
    CURLOPT_HEADER => false
    );
    // We assume nobody's going to try to overwrite the settings above
    if(is_array($settings_array)){
    array_merge($curl_options,$settings_array);
    }
    if(!$curl_open = curl_init()){
    $return = false;
    }
    curl_setopt_array($curl_open, $curl_options);
    $return = curl_exec($curl_open);
    curl_close($curl_open); // Close CURL
    } elseif(function_exists("passthru")) {
    $cmd = "curl -m $timeout -s-url ".$url.""; // Set up command
    echo $cmd;
    /* The only way I could get a correctly formated file into a variable */
    ob_start();
    passthru($cmd, $status); // Run command
    $return = ob_get_contents(); // Put everything into the variable
    ob_end_clean();
    if($status > 1) {
    $return = false;
    }
    } else {
    trigger_error("Unable to run cURL", E_USER_ERROR);
    $return = false;
    }
    return $return; // Why???
    }
    ?>