[SOLVED] including a file into a variable...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

[SOLVED] including a file into a variable...

Post by batfastad »

OK here's a quick question...

I have an HTML file which is on our database server at http://db.domain.com:575/query?-db=data ... ml&-update

That returns a number on to an html page. At the moment in my PHP scripts I can include this to display that number on my site.

Though for this specific task I need to get this number into a variable.

I'm assuming it's not as simple as just going...

Code: Select all

<?php

$var = include("http://db.domain.com:575/query?-db=data&-format=recordcount.html&-update");

?>
Any ideas?

Thanks
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Try:

Code: Select all

$var = file_get_contents('http://db.domain.com:575/query?-db=data&-format=recordcount.html&-update');
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

Post by batfastad »

Excellent!

Thanks for your fast reply!
Post Reply