Jump to content

Recommended Posts

well im trying to get the redirected url of this page

 

http://vidz.ebookzi.com/redirect.php

 

and define in to a variable so i could manipulate it anyway i like

The php itself open the url and gain the redirected url and define it to a variable

 

hope that helps

i want to define a variable with new url,

 

http://vidz.ebookzi.com/redirect.php --this directs to --> http://vidz.ebookzi.com/redirected.php

 

hence using some sort of code i would like to obtain the url "http://vidz.ebookzi.com/redirected.php" and define it to a variable

 

i think its possible by using the function fsocketopen()

 

$fp = fsockopen( "http://vidz.ebookzi.com/redirect.php", 80, &$errno, &$errdesc);
$request = "Referer: ";
$url = ?? //Newurl(Redirected url) i.e http://vidz.ebookzi.com/redirected.php

some thing like this!

hope this explains it

Ur my hero prozente

it works really well

but how come i dont get the redirected url for a flash,

im tryng to gain the redirected url of lets say

 

http://www.dailymotion.com/swf/maX6GkyCdEPSl9n5j

 

so my code is

<?php
error_reporting(E_ALL);

$service_port = getservbyname('www', 'tcp');
$address = gethostbyname('dailymotion.com');

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
   echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n";
}

$result = socket_connect($socket, $address, $service_port);
if ($result < 0) {
   echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
}

$in = "GET /swf/2nWJZC4oOeGTLbZm1 HTTP/1.0\r\n";
$in .= "Host: dailymotion.com\r\n";
$in .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\r\n";
$in .= "Accept: text/xml,application/xml,application/x-shockwave-flash,application/xhtml+xml,text/html;text/plain\r\n";
//$in .= "Accept: application/x-shockwave-flash\r\n";
$in .= "Accept-Language: en-us,en\r\n";
$in .= "Accept-Charset: ISO-8859-1,utf-8\r\n";
$in .= "Connection: Close\r\n\r\n";
$out = '';
$data = '';

socket_write($socket, $in, strlen($in));

while ($out = socket_read($socket, 2048)) {
  $data .= $out;
}

socket_close($socket);

preg_match("/Location: (.*)\r\n/", $data, $matches);
//$test = preg_match("/http:\/\/www\.dailymotion\.com\/flash\/flvplayer\.swf\?(.*)+/", $data, $matches);
echo $matches[1];
//echo $test;
?>

which just returns the Main page url not the redirected one

any help please.

thanks

  • 1 month later...

is there anyway to find the url without using socket_create() or any socket families, such as using fopen

ive tried the code below but it won't return any value..

$pagehandle=@fopen("http://www.dailymotion.com/swf/2nWJZC4oOeGTLbZm1/","rb"); 
  $contents = ""; 
  do { 
    $data = @fread($pagehandle, 8192); 
    if (strlen($data) == 0) { 
      break; 
    } 
    $contents .= $data; 
  } while(true); 
  @fclose($pagehandle); 
  preg_match("/Location: (.*)\r\n/", $contents, $matches);
return $matches[1];

im using a linux server and the hosting provider doesn't allow any socket family function to execute is there another way to find the redirected url with other function please

 

Thanks in advance

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.