Does any one know how you can make a script which goes through a .css file, and it will insert all the background image URL's into a database?
Printable View
Does any one know how you can make a script which goes through a .css file, and it will insert all the background image URL's into a database?
Not too sure but wouldn't you make it so your database is able to grab all the files?
The database dosn't get the files, its the script which does it.
The database is just a place to store data :P
I have a feeling the scritp will use file_get_contents :P
Yep, you'd use file_get_contents and preg_match_all, although the problem is people can lay out their backgrounds differently ... and therefore it's going to be near impossible to get all of them.
I'm not sure if this is correct or not to don't bash me but couldn't he just store them in a file CHMOD'd t 777 and useto fetch them?PHP Code:($con = fsockopen(filewhateverhere);
Humm, iv never been good with these functions :P
All I have is:
Which gets the first one xDPHP Code:<?php
$url = "http://www.habbo.co.uk/myhabbo/styles/assets.css";
$page = file_get_contents("$url");
$start = explode("background-image: url(", $page, 2);
$end = explode(");", $start[1], 2);
$sticker = trim($end[0]);
echo ("$sticker");
?>
because there backgrounds are added from a panel, the set out is all the same :)
Research is key :)