not able to access a URL with LWP::UserAgent.

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default not able to access a URL with LWP::UserAgent.

    I need to solve this problem with perl, forgive me if it stretches the
    'params' of this group. thanks

    This problem originated from not being able to access a URL with
    LWP::UserAgent.

    Error, cant get page [url]https://webpage.jsp[/url] -- 302 Moved Temporarily
    Aborting at ./curu.pl line 77.
    (sorry it's an intranet page,... not available outside)
    (yes, i am also using use Crypt::SSLeay for SSL support)

    I can access the url/page fine from any GUI browser.

    I thought to check lynx: (my only other 'text' based http protocol resource.
    (lynx -version has ssl support)
    # lynx: Can't access startfile [url]https://webpage.jsp[/url]
    # HTTP/1.1 302 Moved Temporarily
    # Data transfer complete
    # HTTP/1.1 302 Moved Temporarily
    # Alert!: Redirection limit of 10 URL's reached.

    I know this is because of a redirection loop at the start of the url. how
    can i write around this?
    I even have found out where it's get's re-directed and tried to acces that
    directly, no success.

    So i can not access the page from any 'text' based script or browser. (?!)
    As im reading this, it sounds like a https protocal issue (or ssl) and not a
    perl issue but i really
    have to solve this issue with perl. - I have to be able to access this page
    wtih perl, any ideas?

    thank you.






    __danglesocket__

    danglesocket Guest

  2. Similar Questions and Discussions

    1. LWP::UserAgent and HTTP_ACCEPT
      I want to accept only certain mime types with LWP::UserAgent. What is the most failsafe way to do this? I doubt that sending an accept header is...
    2. Not able to use LWP::UserAgent::Authenticated
      Hi All when i am trying to use my $ua = LWP::UserAgent::Authenticated->new( $LOGINID, $PASSWORD ); its giving me error Can't locate...
    3. URGENT: no response - LWP::UserAgent
      Hi, I was using the LWP::UserAgent module for about 4 month with no problems, sudenly it stopped working. Nothing has been changed. I tested the...
    4. Problems with LWP::UserAgent
      I am trying to create a spider to grab my books off of Safari for a batch printing job so I don't need to go through each chapter myself and...
    5. 'LWP::UserAgent' does not get any page
      Hello. I'm trying to get the content of yahoo.com (I tried with other URLs). I run this script on a Linux PC. ...
  3. #2

    Default Re: not able to access a URL with LWP::UserAgent.

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, 11 Sep 2003 12:57:02 -0400, danglesocket wrote:
    > I need to solve this problem with perl, forgive me if it stretches the
    > 'params' of this group. thanks
    >
    > This problem originated from not being able to access a URL with
    > LWP::UserAgent.
    >
    > Error, cant get page [url]https://webpage.jsp[/url] -- 302 Moved Temporarily
    [snip...]

    Try a real URL. Looks like your server is "webpage.jsp", can
    you "ping webpage.jsp"? If not then your url is bad. Also, if that is the
    server name, try putting a '/' on the end of it, thats the way it should
    be.
    > thank you.
    [snip 6 blank lines before your name...]
    > __danglesocket__
    - Brian
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (GNU/Linux)

    iD8DBQE/YLauiK/rA3tCpFYRAmLoAKCZB7obGtoi04JqftbmUh4YgvAT6ACfU0ns
    rtK7cykR8UTUKWqxCSu6o9A=
    =2dX8
    -----END PGP SIGNATURE-----

    Brian Harnish Guest

  4. #3

    Default Re: not able to access a URL with LWP::UserAgent.

    On Thu, 11 Sep 2003 12:57:02 -0400, danglesocket wrote:
    > I need to solve this problem with perl, forgive me if it stretches the
    > 'params' of this group. thanks
    >
    > This problem originated from not being able to access a URL with
    > LWP::UserAgent.
    >
    > Error, cant get page [url]https://webpage.jsp[/url] -- 302 Moved Temporarily
    [snip...]

    Try a real URL. Looks like your server is "webpage.jsp", can
    you "ping webpage.jsp"? If not then your url is bad. Also, if that is the
    server name, try putting a '/' on the end of it, thats the way it should
    be.



    Rather than responding with a half assed answer that proves that you didn't
    read the question and
    tries to make me look like an idiot, either don't respond or offer somthing
    more 'insightful'.

    original post stated, "I can access the url/page fine from any GUI
    browser." and that
    (sorry it's an intranet page,... not available outside)

    -how would i be able to do that if this was a simple non-existant url
    issue.
    [url]https://webpage.jsp[/url] - i thought it was clear that this was an example, not a
    real url, sorry if that wasn't clear.

    - i guess i should have used [url]https://example.org/webpage.jsp[/url]. - RFC 2606,
    Section 3.
    or [url]https://localhost/webpage.jsp[/url]

    thanks anyway.

    __danglesocket__

    danglesocket Guest

  5. #4

    Default Re: not able to access a URL with LWP::UserAgent.

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    On Thu, 11 Sep 2003 15:31:49 -0400, danglesocket wrote:
    > Rather than responding with a half assed answer that proves that you didn't
    > read the question and
    > tries to make me look like an idiot, either don't respond or offer somthing
    > more 'insightful'.
    >
    > original post stated, "I can access the url/page fine from any GUI
    > browser." and that
    > (sorry it's an intranet page,... not available outside)
    >
    > -how would i be able to do that if this was a simple non-existant url
    > issue.
    > [url]https://webpage.jsp[/url] - i thought it was clear that this was an example, not a
    > real url, sorry if that wasn't clear.
    >
    > - i guess i should have used [url]https://example.org/webpage.jsp[/url]. - RFC 2606,
    > Section 3.
    > or [url]https://localhost/webpage.jsp[/url]
    I read the question. It's often easiest to help solve the problem when you
    know what all the variables are in the problem. Perhaps the problem is
    with your url (not the one you said, but the one you really did use) and
    all the GUI browsers take into account crappy URL's that LWP and Lynx
    don't.

    And no, it's not clear that you replaced the url when you quoted the rest
    of the error message. "Error, cant get page [url]https://webpage.jsp[/url] -- 302
    Moved Temporarily Aborting at ./curu.pl line 77." If you go around
    changing what the error messages say, without explicitly saying you did,
    why not change the line number too?

    For a starter, try ditching simplifying by ditching the ssl part.

    A Half assed answer to a half assed question.

    - Brian
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (GNU/Linux)

    iD8DBQE/YNcUiK/rA3tCpFYRAuhsAJ9bwRju3+kJj9pjI3wbO35dG/NlJQCfVrKZ
    mioQ5Qt69g2NqYq5MvsQtAY=
    =HSMu
    -----END PGP SIGNATURE-----

    Brian Harnish Guest

  6. #5

    Default Re: not able to access a URL with LWP::UserAgent.

    danglesocket <danglesocket@no_spam> wrote in message news:<3f60cda7@shknews01>...
    > Rather than responding with a half assed answer that proves that you didn't
    > read the question and
    > tries to make me look like an idiot, either don't respond or offer somthing
    > more 'insightful'.
    Whoa, don't take things so personally...that's harsh, considering two
    things:

    1. You're asking for free advice.
    2. Really don't see where he was trying to make you look like an idiot
    or that a 'half assed answer' was offered. Speaking from *personal*
    experience (time wasted looking for something complex when something
    simple was breaking my script), its best to *first* look at basic
    things when debugging.

    Not sure if LWP has some kind of redirection limit (I wouldn't think
    that it does), but from the lynx error message you got it seems that
    the original URL is being redirected a number of times. LWP::UserAgent
    follows redirects automatically. If you deal with the redirects
    manually, you can trace what's happening along the way:

    ====CODE
    #!/usr/bin/perl -w
    use strict;
    use LWP;

    my $url = 'your_URL_here';
    my $ua = LWP::UserAgent->new(
    requests_redirectable => [] # don't follow redirects
    );
    my @urls = ($url);
    while ( @urls ) {
    my $r = $ua->head( shift @urls );
    if ($r->is_redirect) {
    print $r->status_line, "\n"; # server response
    print "Redirected: ", $r->header('location'),"\n"; # redirect URL
    push @urls, $r->header('location');
    }
    }

    Then you can see the URL of each redirect, and hopefully, where the
    problem is occurring.

    HTH - keith
    ko Guest

  7. #6

    Default Re: not able to access a URL with LWP::UserAgent.

    ko <kuujinbo@hotmail.com> wrote:
    > danglesocket <danglesocket@no_spam> wrote in message news:<3f60cda7@shknews01>...
    >> Rather than responding with a half assed answer that proves that you didn't
    >> read the question and
    >> tries to make me look like an idiot, either don't respond or offer somthing
    >> more 'insightful'.
    >
    > Whoa, don't take things so personally

    I plonked him when I saw his followup.


    --
    Tad McClellan SGML consulting
    [email]tadmc@augustmail.com[/email] Perl programming
    Fort Worth, Texas
    Tad McClellan Guest

  8. #7

    Default Re: not able to access a URL with LWP::UserAgent.

    >>> ko<kuujinbo@hotmail.com> 9/11/2003 9:16:58 PM >>>
    danglesocket <danglesocket@no_spam> wrote in message
    news:<3f60cda7@shknews01>...
    > Rather than responding with a half assed answer that proves that you
    didn't
    > read the question and
    > tries to make me look like an idiot, either don't respond or offer
    somthing
    > more 'insightful'.
    Whoa, don't take things so personally...that's harsh, considering two
    things:

    1. You're asking for free advice.
    2. Really don't see where he was trying to make you look like an idiot
    or that a 'half assed answer' was offered. Speaking from *personal*
    experience (time wasted looking for something complex when something
    simple was breaking my script), its best to *first* look at basic
    things when debugging.


    -you're right. thanks for the response. apologies to Brian, thanks for the
    suggestions.





    __danglesocket__

    danglesocket Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139