View Single Post
Old 09-04-2011, 11:59 AM  
Dvae
Confirmed User
 
Dvae's Avatar
 
Industry Role:
Join Date: Feb 2005
Location: US
Posts: 5,326
Quote:
Originally Posted by scottybuzz View Post
no i have the first link only

http://www.dhdmedia.com/directors/wi...key=&dcdid=122
i have 100 in this format

load this up and it turns into a new link. I want to import this list and get the list of new links.

if someone can make me a script for this then please email me [email protected]

Try this:
PHP Code:
<html>
<head>
    <title>Untitled Test</title>
    <meta name="generator" content="BBEdit">
</head>

<body>
<font size=1 face=verdana>

<?php
$pages_array 
= array(
"http://www.dhdmedia.com/directors/wifeycash?dcwid=124465&dcokey=&dcdid=120",
"http://www.dhdmedia.com/directors/wifeycash?dcwid=124465&dcokey=&dcdid=119",
"http://www.dhdmedia.com/directors/wifeycash?dcwid=124465&dcokey=&dcdid=118",
);


function 
follow_redirect($url){
   
$redirect_url null;

   if(
function_exists("curl_init")){
      
$ch curl_init($url);
      
curl_setopt($chCURLOPT_HEADERtrue);
      
curl_setopt($chCURLOPT_NOBODYtrue);
      
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      
$response curl_exec($ch);
      
curl_close($ch);
   }
   else{
      
$url_parts parse_url($url);
      
$sock fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80));
      
$request "HEAD " $url_parts['path'] . (isset($url_parts['query']) ? '?'.$url_parts['query'] : '') . " HTTP/1.1\r\n";
      
$request .= 'Host: ' $url_parts['host'] . "\r\n";
      
$request .= "Connection: Close\r\n\r\n";
      
fwrite($sock$request);
      
$response fread($sock2048);
      
fclose($sock);
   }

   
$header "Location: ";
   
$pos strpos($response$header);
   if(
$pos === false){
      return 
false;
   }
   else{
      
$pos += strlen($header);
      
$redirect_url substr($response$posstrpos($response"\r\n"$pos)-$pos);
      return 
$redirect_url;
   }
}
for(
$idx 0$idx count($pages_array); ++$idx) {
$idx_cnt $idx+1;
$url = ($pages_array[$idx]);
// 
// echo '<ol>';
while(($newurl follow_redirect($url)) !== false){
//    echo '<li>', $url, '</li>';
   
echo $url' ';
   
$url $newurl;
}
// echo '</ol>';

 
echo '<a href="'$url'">'$url'</a><br>';
//echo ' $url';
}
?>

</font></body>
</html>
__________________
.
.

Arguing with a troll is a lot like wrestling in the mud with a pig, after a couple of hours you realize the pig likes it.
Dvae is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote