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 />';
}
?>
Opening Multiple Files/Links in Order.
I want to open links in order/one-by-one and check each for a specific string.Example: If i open CL, search for ads pertaining to video games. Returns 20 results. I grab these links. Now i want to
explode() function problem maybe
Hi I'm having trouble searching my database. When I type two words in the search field it only searches for the second word. For example: if I typed london zoo , it will only search for zoo.Is this
duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or not. How can I do this ??
Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and give the total amount of sales?
Database connection failure
Hello All,
Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:Can a php script be written to make a judgement call on whether or not to display a flash animation or *jpeg based on a
Schedule editor
Hi,
Need Help with a query
Hello, For some reason I am just not getting the right answer when I do this query and not quite sure why? $runinposition = mysql_query("SELECT * FROM bb_off WHERE user='$user' AND test1='test1'
need help modifying script
Hi guys,I'm fairly new to php and am having a bit of trouble modifying a script.This is the script:Code: <?php##############################################################################
Somebody hacked into my site and changed coding >>> URGENT HELP NEEDED <<<
I am not that much into programming , but somebody is hacking to my site and injecting some kind of iframes ... it happened to another site , but that wasn't that important for me, but now it has