When I do like this...

#!/usr/bin/env perl use strict; use warnings; use WWW::Curl::Easy; use Data::Dump; my $fetch = sub { my $curl = WWW::Curl::Easy->new(); my ( $header, $body ); $curl->setopt( CURLOPT_URL, shift ); $curl->setopt( CURLOPT_WRITEHEADER, \$header ); $curl->setopt( CURLOPT_WRITEDATA, \$body ); $curl->setopt( CURLOPT_FOLLOWLOCATION, 1 ); $curl->setopt( CURLOPT_TIMEOUT, 10 ); $curl->setopt( CURLOPT_SSL_VERIFYPEER, 1 ); $curl->perform; { header => $header, body => $body, info => $curl->getinfo(CURLINFO_HTTP_CODE), error => $curl->errbuf, }; }; my $result = $fetch->(shift); dd $result; __END__

...i get:

karls-mac-mini:playground karl$ ./curl.pl https://sharecenter.com/Page +s/Software.aspx { body => undef, error => "SSL peer certificate or SSH remote key was not OK", header => undef, info => 0, }

...but with $curl->setopt( CURLOPT_SSL_VERIFYPEER, 0 ); i get:

karls-mac-mini:playground karl$ ./curl.pl https://sharecenter.com/Page +s/Software.aspx { body => "<!-- b2 -->", error => "", header => "HTTP/1.0 200 OK\r\nDate: Mon, 22 Jan 2018 09:47:51 GMT\r\ +nServer: Apache/2.2.22\r\nExpires: Mon, 26 Jul 1997 05:00:00 GMT\r\nL +ast-Modified: Mon, 22 Jan 2018 09:47:51 GMT\r\nCache-Control: no-stor +e, no-cache, must-revalidate\r\nCache-Control: post-check=0, pre-chec +k=0\r\nPragma: no-cache\r\nSet-Cookie: tu=dc6816b4e45149c7421e46e3905 +2dfef; expires=Tue, 31-Dec-2019 23:00:00 GMT; Max-Age=61218729; path= +/; domain=sharecenter.com; httponly\r\nX-Adblock-Key: MFwwDQYJKoZIhvc +NAQEBBQADSwAwSAJBANnylWw2vLY4hUn9w06zQKbhKBfvjFUCsdFlb6TdQhxb9RXWXuI4 +t31c+o8fYOv/s8q1LGPga3DE1L/tHU4LENMCAwEAAQ==_heva/qNbVoSrOKfx6K0UI/De +onTq8ke19pivgTgrL2w9ZtF3/lPIuu2AIlia5FA69jmNJzQb9Afod5WU1oglQw==\r\nV +ary: Accept-Encoding\r\nContent-Length: 11\r\nContent-Type: text/html +; charset=UTF-8\r\nX-Cache: MISS from 110132\r\nConnection: close\r\n +\r\n", info => 200, }

I don't know if this helpful and is what you expected.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help


In reply to Re: How to get html code from a secure (https:\\) page? by karlgoethebier
in thread How to get html code from a secure (https:\\) page? by hahnfam

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.