Page 1 of 1

extract url function

Posted: Sat Feb 27, 2010 6:20 am
by Abdul202
i want to creat a script do the following
to extract urls from a page contains any of the following word
rapidshare
megaupload
hotfile
zshare
and whatever else..............
i was trying to make a script to extract all urls and then print only which contain the words that i want
but i couldn't do it i'm a beginner php programer
i'm now tryin to programe it using a diffrent technique
using in_array function
that function will contain few strings because the page which i want to exctat urls from contain just few strings
i want to extract from a page used to protect urls
http://1tool.biz/265677
but i still couldn't achieve what i want
i wrote the following

Code: Select all

 
<?php
// make sure the remote file is successfully opened before doing anything else
$url="http://1tool.biz/265677";
if ($fp = fopen($url, 'r')) {
   $content = '';
   // keep reading until there's nothing left
   while ($line = fgets($fp, 1024)) {
      $content .= $line;
   }
$array_content= explode(" ",$content);// all lines are stored in $array_content
// i want to write a code here to print only text match the following
if (in_array("rapidshare",$array_content))
  {
  echo "the full link <br />";
  }
else
  {
  echo "Match not found<br />";
  }
if (in_array("megaupload",$array_content))
  {
echo "the full link <br />";  }
else
  {
  echo "Match not found<br />";
  }
 
if (in_array(hotfile,$array_content))
  {
echo "the full link <br />";  }
else
  {
  echo "Match not found<br />";
  }
 
} else {
   // an error occured when trying to open the specified url
}
 
 
?>
 
so i convert the all the page into an array so it will using space as a separator because urls shouldn't contain any spaces
but i don't know how to print the full text which contain one of the following strings as an example
rapidshare
megaupload
hotfile
zshare
and whatever else..............
really i'll be very thankful if someone will help me to create such script
thanks in advance..

Re: extract url function

Posted: Thu Mar 04, 2010 9:18 am
by bhupinder1045
Abdul202 wrote:i want to creat a script do the following
to extract urls from a page contains any of the following word
rapidshare
megaupload
hotfile
zshare
and whatever else..............
i was trying to make a script to extract all urls and then print only which contain the words that i want
but i couldn't do it i'm a beginner php programer
i'm now tryin to programe it using a diffrent technique
using in_array function
that function will contain few strings because the page which i want to exctat urls from contain just few strings
i want to extract from a page used to protect urls
http://1tool.biz/265677
but i still couldn't achieve what i want
i wrote the following

Code: Select all

 
<?php
// make sure the remote file is successfully opened before doing anything else
$url="http://1tool.biz/265677";
if ($fp = fopen($url, 'r')) {
   $content = '';
   // keep reading until there's nothing left
   while ($line = fgets($fp, 1024)) {
      $content .= $line;
   }
$array_content= explode(" ",$content);// all lines are stored in $array_content
// i want to write a code here to print only text match the following
if (in_array("rapidshare",$array_content))
  {
  echo "the full link <br />";
  }
else
  {
  echo "Match not found<br />";
  }
if (in_array("megaupload",$array_content))
  {
echo "the full link <br />";  }
else
  {
  echo "Match not found<br />";
  }
 
if (in_array(hotfile,$array_content))
  {
echo "the full link <br />";  }
else
  {
  echo "Match not found<br />";
  }
 
} else {
   // an error occured when trying to open the specified url
}
 
 
?>
 
so i convert the all the page into an array so it will using space as a separator because urls shouldn't contain any spaces
but i don't know how to print the full text which contain one of the following strings as an example
rapidshare
megaupload
hotfile
zshare
and whatever else..............
really i'll be very thankful if someone will help me to create such script
thanks in advance..