alwex / php-casperjs

simple PHP wrapper for CasperJS
MIT License
182 stars 71 forks source link

please help,i cant get any page with https #47

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi guys,im using phantomsjs 2.1.1, php 5.6, casperjs 1.1.0, and im running localhost. im ok getting pages with http,but i cant get anything with https, i have read about this everywhere,i have tried another versions of casperjs and phantomjs ,and everything ive seen,but anything is working for me . Oh,also im usign the jonnnnyw.github.io/php-phantomjs/ version. So Im leaving you here the debug code and my script code,because thats better than 1000 words,lmao. Thank u very much guys! /*** Debug Code im getting ****/ array (size=22) 0 => string '[info] [phantom] Starting...' (length=28) 1 => string '[info] [phantom] Running suite: 3 steps' (length=39) 2 => string '[debug] [phantom] Successfully injected Casper client-side utilities' (length=68) 3 => string '[debug] [phantom] opening url: https://www.cubamaltrato.com/, HTTP GET' (length=70) 4 => string '[debug] [phantom] Navigation requested: url=https://www.cubamaltrato.com/, type=Other, willNavigate=true, isMainFrame=true' (length=122) 5 => string '[info] [phantom] Step anonymous 1/3: done in 73ms.' (length=50) 6 => string '[warning] [phantom] Loading resource failed with status=fail: https://www.cubamaltrato.com/' (length=91) 7 => string '[info] [phantom] Step _step 2/3: done in 1295ms.' (length=48) 8 => string '[info] [phantom] wait() finished waiting for 10000ms.' (length=53) 9 => string 'timeout occured' (length=15) 10 => string '[CURRENT_URL]about:blank' (length=24) 11 => string '[CURRENT_TITLE]' (length=15) 12 => string '[CURRENT_PAGE_CONTENT]' (length=61) 13 => string '[CURRENT_HTML]' (length=53) 14 => string '[CURRENT_HEADERS][]' (length=19) 15 => string '[CURRENT_STATUS]null' (length=20) 16 => string '[CURRENT_STATUS_TEXT]null' (length=25) 17 => string '[CURRENT_COOKIES][]' (length=19) 18 => string '[info] [phantom] Step anonymous 3/3: done in 11301ms.' (length=53) 19 => string '[info] [phantom] Done 3 steps in 11317ms' (length=40) 20 => string '[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true' (length=104) 21 => string '[debug] [phantom] url changed to "about:blank"' (length=46)

/** my script code / use Browser\Casper; $casper = new Casper(); $casper->setPath2Casper('my path to casperjs/bin/'); //some people said this is the answer but it wasnt for me :( $casper->setOptions(array('ignore-ssl-errors' => 'yes','ssl-protocol' => 'any','debug' => 'true')); $casper->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'); //some page with https $casper->start('https://www.cubamaltrato.com'); $casper->wait(10000); $output = $casper->getOutput(); $start = $casper->run(); //this one returns the debug code from above var_dump($start); //and this one just an empty array var_dump($output); //this one returns the html only when the page is using http $html = $casper->getHtml();