im not sure why GD is involved, but for the calls using LWP::UserAgent i have a few suggestions. Lets assume you code looks like

my $ua = new LWP::UserAgent(); my $req = new HTTP::Request (GET => $uri); my $request = $ua->request ($req);
have you inspected $request->content and $request->status_line for further info like
500 Can't connect to no.such.server.in.my.lan:80 (Bad hostname)
That may help you identify what is going on.

ssl problems can also case a 500. if you change the line to

my $ua=LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
and it starts working it means you probably have outdated certificates. rather than to continue to skip ssl verification there are modules to update. Mozilla::CA IO::Socket::SSL Net::SSLeay come to mind.

if those dont seem to identify the problem add this

Use Data::Dumper; print Dumper ($request);
That will dump the entire request hash, and inspecting it may provide further insight

one more thought. There may be some sort of blocking base on the agent. If you change the line to

my $ua = new LWP::UserAgent(agent =>"myagent");
and it starts working someone is filtering lwp. another agent you could try is something like
my $ua = new LWP::UserAgent(agent =>"Mozilla/5.0 (Windows NT 5.1; rv +:51.0) Gecko/20100101 Firefox/51.0");


In reply to Re: GD and LWP giving 500 errors by huck
in thread GD and LWP giving 500 errors by Schmunzie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.