Ok, so this is the whole code:

#!"E:\xamp\perl\bin\perl.exe" -T use 5.010; use CGI; use strict; use warnings; use LWP::UserAgent; use LWP::Simple; use HTML::TreeBuilder; my $q = CGI->new(); my $userag = LWP::UserAgent->new(timeout=>30); #it's illegal :( + p.s. to make what they say, delete argument from "new" +"agent => 'MyApp/0.1'" say $q->header(), $q->start_html(); my $addressdio = ""; #getting the address from form for my $param ($q->param()) { my $safe_param = $q->escapeHTML($param); say "<p><strong>$safe_param</strong>: "; for my $value ($q->param($param)) { say $q->escapeHTML($value); $addressdio = $q->escapeHTML($value); } say '</p>'; } #the whole process of getting xml from site and giving it into + the string variable #my $dioaddress = "http://dx.doi.org/10.1016/j.nuclphysa.2015. +05.005"; my $reqforxml = new HTTP::Request GET => $addressdio; my $res = $userag->request($reqforxml); my $content = $res->content; # my $content = get("$addressdio"); # my $html = get("http://dx.doi.org/10.1007/s00601-015-1012-x") # or die "Couldn't fetch the Perl Cookbook's page."; # print "$html"; #opening the file to write string with xml open my $overwrite, '>', 'overwrite.xml' or die "error trying +to overwrite: $!"; #writing string with xml to the file say $overwrite "$content"; #A little system just to get the title #($title) = $content =~ <h1 class="svTitle" id="ti0010">(.*?)< +/h1>; #print "Title of article: $title"; #my $tree = HTML::TreeBuilder->new; #$tree ->parse_file("overwrite.txt"); #foreach my $h1 ($tree->find('h1')){ #print $h1->as_text, "<br />"; #} close $overwrite; say "<h1>And here's the site:</h1>"; print "$content"; #string with our site say $q->end_html();
I got the XML from ScienceDirect thanks to this: agent => 'MyApp/0.1', but even when I give this paramater to agent while connecting to Link Springer, then the situation is the same like I explained in the first post.

In reply to Re^2: Getting XML from DOI address by hooel
in thread Getting XML from DOI address by hooel

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.