Solved

i want to get specific string from a sentince

Posted on 2008-10-02
1
231 Views
Last Modified: 2012-05-05
$link="http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>"
$link1=http://fdsfsdf/files/1610943/fdsff.rar

i want a command that takes this both and only output http://fdsafacom/files/1610943/fsadfsdf.rar
the second one
http://fdsfsdf/files/1610943/fdsff.rar

i have this one but i dose not work
preg_match_all('/(http:\/\/[^\"]+)/i', $page, $links);
it give me in the first link
http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>"
0
Comment
Question by:mgtm3
1 Comment
 
LVL 15

Accepted Solution

by:
ncoo earned 500 total points
ID: 22625216
You need to add a don't match < like below:
$page="$link=\"http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>\"
$link1=http://fdsfsdf/files/1610943/fdsff.rar";
preg_match_all('/(http:\/\/[^\"^<]+)/i', $page, $links);
print_r($links);

Open in new window

0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question