Hi guys,
What I need to do is take a page & extract all the URLs from the page & place them in an array.
However I only need to grab certain URLS
eg.
site1.com
site1.com/folder/thisfile.zip
site2.com
site2.com/some/folder/or/subfolder/1.mp3
site3.com
but then leave out of the array
site4.com
site5.com/the/script/needs/to/be/able/to/grab/sub/folders/and/files/2.mp3
Here's the script I've got so far but this will grab ALL the links ... so I need to modify this & perhaps use an if or switch statement to check whether it's a link I actually want...
<?php
$string = '<a href="http://www.example.com">Example.com</a> has many links with
examples <a href="http://www.example.net/file.php">links</a> to many sites and
even urls without links like http://www.example.org just to fill the gaps and
not to forget this one http://phpro.org/tutorials/Introduction-to-PHP-Regex.html
which has a space after it. The script has been modifiied from its original so now
it grabs ssl such as https://www.example.com/file.php also';
/**
*
* @get URLs from string (string maybe a url)
*
* @param string $string
*
* @return array
*
*/
function getUrls($string)
{
$regex = '/https?://[^" ]+/i';
preg_match_all($regex, $string, $matches);
return ($matches[0]);
}
$urls = getUrls($string);
foreach($urls as $url)
{
echo $url.'<br />';
}
?>
Timer control causing error
I recently decided to add a timer control to an existing page that uses AJAX on my site. As soon as I added the timer control and ran my app, I started getting the following error:Description: An
Error in query: Resource id #4??
hey guys, having a minor (i think) problem here that i havent been able to figure out. long story short, im building a hockey stat tracking site for a local hockey league around here.my problem is, i
Trigger tag in aspx is not coming
hi all ,iam new to ajax, iam using file upload inside the update pannel but right now i want to use trigger tag but it is not coming, for that whether i want to install anything like toolkit ,please
User input in to variable
Hi all,I'm sure this is very easy but I'm having another brain freeze!At the end of the code I have echoed 3 bits of info to screen $ip, $_POST['ssid'] and $ssid_id".I would like to put
How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But, when the person comes to buy the ticket, I have to replay to my process page which ticket they
Material xxx does not exist in plant xxx
Dear All,
update 2 columns by doing inner 2-column query
Hi,
PHP IMAGE UPLOAD SCRIPT
Hi for the last week i have been looking for scripts that will upload a photo to a certain folder which i can then change the name of it but however i create a thumbnail of 140 width and 130 height
Estimations and Effort
HI Gurus,
I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES ('{$varItem}', {$varRating}, '{$ipAddress}', NOW())", "InsertRating";Parse error