Hi Sewi:

> Find a way to get debug messages > from your script. This may be > print STDERR, a temp log file > in /tmp or anything else.

yes, I already print everything into a log file

> Then print the exact URL you > use for the LWP call and also > the error message from your > LWP handle.

the URL is fine

> You should also print $ENV{http_proxy}

no proxy found

Anycase: the exact message that I get from the KWP user agent is the following:

500 Can't connect to www.sandbox.paypal.com:80 (Bad hostname 'www.sandbox.paypal.com')

And if I add the hostname into /etc/hosts the status line turns to:

500 Can't connect to www.sandbox.paypal.com:80 (Permission denied)

and this latter status line is also given if I change the URL with the corresponding IP:

500 Can't connect to 216.113.191.82:80 (Permission denied)

but this doesn't prove anything because maybe there could be many virtual hosts with the same IP.

Finally, as you are suggesting:

> If really everything is fine, try a > print logfile `ping -c 1 host.name.com 2>&1`;

I tried to ping the PayPal SandBox without involving LWP, I just pinged it with backticks. This is the returned message:

unknown host www.sandbox.paypal.com

It looks like DNS is not resolved, but only when the script is called by Apache. When the script is called from the command line the DNS is properly resolved, and the script works just fine.

BTW: on another web server, with Fedora 4 instead of Fedora 5, the entire set of scripts work fine even when called by Apache.

Thanks for your help. Alvise.


In reply to Re^2: Bad hostname by alvise
in thread Bad hostname by alvise

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.