Jump to content

evasec

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by evasec

  1. Thanks Ken2k7, I don't have control over the pages, I'm trying to build a tool that will output the last (and real) location of the file. In this example it's http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/. So I guess I'm looking for something that says: http://raoul.shacknet.nu/servers/vnc.html redirects to http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/ I can then input the urls and find out where they actually end up. Cheers for helping here!
  2. Hi All, Apologies if I didn't explain this in enough detail. The output from 'curl -I -L http://raoul.shacknet.nu/servers/vnc.html' is like this. I'm looking to get the same using PHP and cURL. You can see that there are several redirects. HTTP/1.1 301 Moved Permanently Vary: Accept-Encoding Location: http://www.raoul.shacknet.nu/servers/vnc.html Content-Type: text/html; charset=iso-8859-1 Date: Wed, 06 May 2009 16:16:18 GMT Server: Apache/2.2.11 HTTP/1.1 301 Moved Permanently Vary: Accept-Encoding Location: http://www.g-loaded.eu/servers/vnc.html Content-Type: text/html; charset=iso-8859-1 Date: Wed, 06 May 2009 16:16:18 GMT Server: Apache/2.2.11 HTTP/1.1 301 Moved Permanently Vary: Accept-Encoding Location: http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/ Content-Type: text/html; charset=iso-8859-1 Date: Wed, 06 May 2009 16:16:18 GMT Server: Apache/2.2.11 HTTP/1.1 200 OK Vary: Accept-Encoding ETag: "29d6f1-f3c8-4693d76afd900" Accept-Ranges: bytes Expires: Wed, 06 May 2009 16:21:18 GMT Content-Length: 62408 Last-Modified: Wed, 06 May 2009 12:23:32 GMT Content-Type: text/html; charset=UTF-8 Cache-Control: max-age=300, must-revalidate Date: Wed, 06 May 2009 16:16:18 GMT Server: Apache/2.2.11
  3. Hi, thanks for reading. Yes it would, but the code I have is only outputting URL2, i.e. the first redirect. I can't get it to output all of them. Do I need a loop or does the PHP version of cURL have it as a built in function that it loops through?
  4. Hi All, I'm pretty new to PHP so excuse my n00b questions but... I want to output all redirection headers that result from a single URL using cURL. For example, if I have; URL1 -> URL2 -> URL3 where -> means redirect I want to get URL2 and URL3 from entering URL1. In cURL it would be like this curl -I -L http://raoul.shacknet.nu/servers/vnc.html ..but I don't know how to output it properly in PHP. Does anyone know How to solve this problem? At the moment I have the following PHP code which gets me to URL2 but not URL3: <?php if($_POST['Submit']) { $redirect = $_POST['redirect']; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,$redirect); curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION); curl_setopt($curl_handle,CURLOPT_NOBODY); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,true); $buffer = curl_exec($curl_handle); curl_close($curl_handle); print $buffer; } else { print <<<ENDOFTXT </style><form name="form1" method="post" action="curltest.php"> <table width="300" border="0" align="left"> <tr> <td width="150"><span class="style5">URL:</span></td> <td width="150"><input name="redirect" type="text" id="redirect"></td> <input name="Submit" type="submit" class="style5" value="Submit"></td> </tr> <tr> <td colspan="2"><div align="center"></div></td> </tr> </table> <p align="center"> </p> </form> ENDOFTXT; } ?> Thanks in advance to anyone that can help me out here.. Evasec
×
×
  • 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.