Page 1 of 1

Resource id #3

Posted: Tue Aug 15, 2006 1:57 pm
by afbase
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have an issue with my code.  my  code returns an evil 'resource id#3'.  I want my code to just return the webpage in my fopen ().  I really am a noob @ php but eventually i want to build a php based stock screener.  I am having issues pulling/getting stock data and financial statements for free from databases so i figured that i would try Moneycentral website as my source for stock/company information.

if anyone knows where i can pull financial statements from a database or something for free, it would be very helpful!!!!!!

Code: Select all

class stockform{
//Set functions
function set_retrieve($ticker){
$setstock = fopen ("http://moneycentral.msn.com/detail/stock_quote?Symbol=".$ticker."", 'r');
return $setstock;
}
}
$stock = new stockform();
print_r ($stock->set_retrieve($_GET['ticker']));

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Aug 15, 2006 2:11 pm
by neophyte
Why not just use:

Code: Select all

$file = file_get_contents("http://yoururl/goes/here");

Posted: Tue Aug 15, 2006 2:37 pm
by afbase
thanks for the tip. I didn't know that was a built in function. I am a PHP noob

Posted: Tue Aug 15, 2006 4:26 pm
by nickvd
You may also want to read the manual's entry for fopen, just so you are aware of its use in the future...

Posted: Tue Aug 15, 2006 7:48 pm
by RobertGonzalez
Description
resource fopen ( string filename, string mode [, bool use_include_path [, resource zcontext]] )

Specifically the part about 'resource'. That is what is returned by the function.