preg_replace knowledge ? help!

Started on the old forum in June 2011 · view the original in the archive · old links redirect here

#pregreplace

2 replies · 315 views · started 15 years ago · 1 min read

2 participants
just_m3. Developer · 199 posts #1

Ok so i've got an advanced grabber script and i try to extract direct download link the main problem / question is if it's possible to include an function in a preg replace per modifier like in the example given bellow

//$grabncopy=site  main source

$grabncopy=preg_replace('/href="(.*).html"/mi', 'href=".get_audio('\\1')."', $grabncopy);

echo $grabncopy;

the modifier should display http://direct_link_name of course without .html extension that will be aded in get_audio function.. i know this ain't gonna work 😒 because i already try it the function will get \1 instead static url.html that the modifier should produce .. the modifier inside the function would not execute ...

More precisely i want to display direct download link with a function that will extract direct download link from the static url/html page and not doing an grabber with two pages one that list and one that would display the download link ... know how to fix it ? 🤨 please reply ... tnx

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

morency Senior · 488 posts #2

I dont understand what you want , but preg_replace return an array , so will be something like $grabcopy[1]

//$pagecontent= bla bla
preg_match('#href="(.*?).html"#',$pagecontent,$link);
$directlink = $link[1];

echo get_audio($directlink)

Unamos los corazones,hoy todos somos multicolores!

just_m3. Developer · 199 posts #3

so simple 🙂) yeah i didn't thinked at that .. that's exactly what i want thanx for the tip 😉 didn't cross my mind

i will modify the code and extract it as you said..

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close