/    Sign up×
Community /Pin to ProfileBookmark

preg_replace error

Hi.

I am trying to replace a part of code from a fetched url

I want to replace part of something like logo.gif to [url]http://www.abc.com/logo.gif[/url]

Can it be done ?

swap

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@bokehJun 15.2006 — Well your question is pretty vague so I'm going to assume you are trying to replace the file name: [code=php]$url = str_replace(basename($url), $new_filename, $url);[/code]
Copy linkTweet thisAlerts:
@swapdudeauthorJun 15.2006 — I am really sorry for the vague question ..

The thing is .. i am trying to fetch a url from remote server and display on my site using a fetch script I found on the internet

The code i am trying to fetch is

<applet code="CaptureClient.class" width="320" height="240" alt="NetCam Live Image">

<param name="image" value="netcam.jpg">

<param name="delayMS" value="500">

<param name="status" value="1">

<param name="statusText" value="Reload in %s seconds">

<param name="statusTextColor" value="#ffffff">

<param name="backgroundColor" value="#000000">

<param name="url" value="">

<param name="noSplash" value="1">

</applet>

The scipt i am using is

http://www.oetzitterd.nl/scripts/contentgrabber.phps

I want edit this line

$code = preg_replace("new code", "old code", $code);

so that instead CaptureClient.class i can have it to outout http://www.abc.com/CaptureClient.class when it displays the source.

i tried

$code = preg_replace("<applet code="http://www.abc.com/CaptureClient.class" width="320" height="240" alt="NetCam Live Image">

", "<applet code="CaptureClient.class" width="320" height="240" alt="NetCam Live Image">

", $code);

But this does not do anything.

Please advice.

Regards

swap
Copy linkTweet thisAlerts:
@bokehJun 15.2006 — If you change the URL how is it ever going to work?
Copy linkTweet thisAlerts:
@swapdudeauthorJun 15.2006 — when it corrently fetches .. it looks for CaptureClient.class in my root directory

it actually exists in the directory of the server abc.com where i got the page from ..

so i have to change the link to http://www.abc.com/CaptureClient.class

Please correct me if i am wrong
×

Success!

Help @swapdude spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...