Read from External file and Send The Query to Server

Hi,
I am working on a finance project and need to get quotes from Yahoo Finance based on the Symbols available in a external file… say symbols.php

It has symbols in the following fashion


Microsoft
Google
Apple
Wallmart
.
.
.
Bell

When I include this symbols file in my parsing script I need to send query as

http://yahoo.com/?s=<symbol1,symbol2... >

My requirement is to append the list from symbols.php make it in a csv format like Google,Apple.Wallmart,Bell

so the query constructs as



How do I perform this required task?


<?php
$symbols = file('path/to/symbols.txt');                //load symbols
$symbols = array_filter($symbols, null);                //remove empty lines
$symbols = array_map('urlencode', $symbols);            //make safe for url


$url = 'http://yahoo.com/?s=' . implode(',', $symbols);    //create url

Thanks for your suggestions, I tried this but get an error basically when I print $symbols[0] etc then only the data is visible; if I print echo $symbols no data is visible and I get warning like Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in /home/… and
Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/…

$symbols = file(‘/home/mysite/public_html/stock/symbols.txt’); //load symbols
echo $symbols; >> No data visible only Array is printed
$symbols = array_filter($symbols, null); //remove empty lines
$symbols = array_map(‘urlencode’, $symbols);

Remove the null.

PS: You cant echo an array. print_r or var_dump it instead.