Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts

    HTTP Header Response

    Morning all, I was using the following code to find the response code to a domain;

    Code:
    use strict;
    use warnings;
    require LWP::UserAgent;
     
    my $ua = LWP::UserAgent->new;
    $ua->timeout(10);
    $ua->env_proxy;
     
    my $response = $ua->get('http://www.actwebdesigns.co.uk/');
    
    if ($response->is_success) {
        print $response->status_line;
    }
    else {
        die $response->status_line;
    }
    yet it seems to return "200 OK" which yes, after the redirect that is correct.
    But for 'http://www.actwebdesigns.co.uk/' is actually 301, could someone point me in the right direction for how I can return the correct response code?
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    Ah, never mind, cracked it with

    Code:
    $ua->max_redirect(0);
    just need to find the location...
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •