title: When pulling a URL from a MYSQL Database, My PHP cURL function won't work
body: <p>I am using this function for my cURL queries.</p>
  
  <pre><code>function get_source($url){
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt ($ch, CURLOPT_HEADER, 0);
  $source = curl_exec ($ch);
  return $source;
  }
  </code></pre>
  
  <p>The function works perfectly, but when I try to run it on a URL from my MySQL database, it wont work...</p>
  
  <p>I have done the following tests...I am trying to get the source of a YouTube video:</p>
  
  <p>Test 1:</p>
  
  <pre><code>echo get_source("http://www.youtube.com/watch?v=WxfZkMm3wcg");
  
  **Result: Works, returns the source code of the video.**
  </code></pre>
  
  <p>Test 2:</p>
  
  <pre><code>$video="http://www.youtube.com/watch?v=WxfZkMm3wcg";
  echo get_source($video);
  
  **Result: Works, returns the source code of the video.** 
  </code></pre>
  
  <p>Test 3:</p>
  
  <pre><code>$video_arr=mysql_fetch_array(mysql_query("SELECT video FROM videos WHERE id='$video_id'")); 
  $video=$video_arr['video'];
  echo get_source($video);
  
  **Result: Does not work. A blank string gets returned and there aren't any cURL errors that I can see...**
  </code></pre>
  
  <p>Test 4 (just to show my query is working)</p>
  
  <pre><code>$video_arr=mysql_fetch_array(mysql_query("SELECT video FROM videos WHERE id='$video_id'")); 
  $video=$video_arr['video'];
  var_dump($video);
  
  **Result: string(38) "http://youtube.com/watch?v=WxfZkMm3wcg"**
  </code></pre>
  
  <p>I am not sure what to do or what is even going wrong. ANy suggestions?</p>