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?

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
I have a feeling the scritp will use file_get_contents![]()
Yeah but it will only return the files in a string by using file_get_contents.
Try this
PHP Code:string file_get_contents ( string $filename [, int $flags [, resource $context [, int $offset [, int $maxlen ]]]] )
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);
Last edited by Bojangles; 04-04-2008 at 11:28 AM.
Humm, iv never been good with these functions
All I have is:
Which gets the first onePHP 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![]()
Last edited by Moh; 04-04-2008 at 11:39 AM.
Okay, probably best to use preg_match_all and then since they're all the same you can use regex to find them ... although I'm not great with regex so I can't help you from nowHumm, iv never been good with these functions
All I have is:
Which gets the first onePHP 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![]()
Want to hide these adverts? Register an account for free!