V
V
v- death2016-01-14 01:23:52
PHP
v- death, 2016-01-14 01:23:52

How to parse the url(") property?

Hello. url("test")You need to extract test from the expression .
Tried to do it with a regular preg_match_all('url/\("(.+?)"\)/', $css, $arr);
expression

Warning: preg_match_all(): Delimiter must not be alphanumeric or backslash in /var/www/game/public/generals_mobi_imageDowload.php on line 4 Warning: Invalid argument supplied for foreach() in /var/www/game/public/generals_mobi_imageDowload. php on line 6

thanks a lot.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
v- deathi, 2016-01-14
@vGrabko99

Thanks for the help index0h !

$css = file_get_contents("http://generals.mobi/styles/main.css");
preg_match_all('/url\("(.+?)"\)/', $css, $arr); 
foreach ($arr as $e) {
    $e = preg_replace('/url\("/', "", $e);
    $e = preg_replace('/"\)/', "", $e);
    print_r($e);
}

A
Alexander Aksentiev, 2016-01-14
@Sanasol

/ is missing at the beginning.
it's written.....

G
glenean, 2016-01-14
@glenean

php.net/manual/en/function.parse-url.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question