function nxs_CptCheckGP($o) { session_id("nxs-temp-gpcpt"); session_start(); $sess = unserialize($_SESSION['nxs-temp-gpcpt']); if (!empty($_POST['c'])) { $ck = $sess['c']; $flds = $sess['f']; $flds['recaptcha_response_field'] = $_POST['c']; $liObj = new nxsAPI_GP(); $hdrsArr = $liObj->headers('https://www.youtube.com/', 'https://www.youtube.com', 'POST', false); $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); prr($advSet); $rep = nxs_remote_post('https://www.youtube.com/das_captcha', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $contents2 = $rep['body']; prr($rep); if (stripos($contents2, 'id="error-box"') !== false) { echo 'The verification code was invalid or has timed out. Please try again.'; die; } if (stripos($contents2, 'The verification code was invalid') !== false) { echo 'The verification code was invalid or has timed out. Please try again.'; die; } if ($rep['response']['code'] == '303' && !empty($rep['headers']['location'])) { echo "OK. You are In"; $hdrsArr = $liObj->headers('http://www.youtube.com', 'https://www.youtube.com'); $ck = $rep['cookies']; $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck); // prr($advSet); $rep = nxs_remote_get($rep['headers']['location'], $advSet); prr($ck); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $ck = $rep['cookies']; } } }
function nxsCptCheck_ajax() { global $nxs_gCookiesArr; $advSettings = array(); if (!empty($_POST['c'])) { $seForDB = get_option('nxs_li_ctp_save'); $ser = maybe_unserialize($seForDB); $nxs_gCookiesArr = $ser['c']; $ck = $nxs_gCookiesArr; $flds = $ser['f']; $flds['recaptcha_response_field'] = $_POST['c']; $liObj = new nxsAPI_LI(); $hdrsArr = $liObj->headers('https://www.linkedin.com/uas/login-submit', 'https://www.linkedin.com', 'POST', false); $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); // prr($advSet); $rep = nxs_remote_post('https://www.linkedin.com/uas/captcha-submit', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $contents2 = $rep['body']; if (stripos($contents2, '<span class="error">') !== false) { echo strip_tags(CutFromTo($contents2, '<span class="error">', '</span>')); die; } if (stripos($contents2, '<div id="global-error">') !== false) { echo CutFromTo($contents2, '<div role="alert" class="alert error">', '</div>'); die; } if (stripos($contents2, 'The email address or password you provided does not match our records') !== false) { echo "Invalid Login/Password"; die; } if (stripos($contents2, 'Hmm, ') !== false) { echo "Invalid Login/Password"; die; } if ($rep['response']['code'] == '302' && !empty($rep['headers']['location']) && stripos($rep['headers']['location'], 'linkedin.com/uas/captcha-submit') !== false) { echo "Wrong Captcha. Please try Again"; } if ($rep['response']['code'] == '302' && !empty($rep['headers']['location']) && (stripos($rep['headers']['location'], 'linkedin.com/nhome') !== false || stripos($rep['headers']['location'], 'linkedin.com/home') !== false)) { echo "OK. You are In"; $hdrsArr = $liObj->headers('http://www.linkedin.com/home', 'https://www.linkedin.com'); $ck = $rep['cookies']; $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck); // prr($advSet); $rep = nxs_remote_get('http://www.linkedin.com/profile/edit?trk=tab_pro', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $ck = $rep['cookies']; if ($_POST['i'] != '') { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) { return; } $options = $plgn_NS_SNAutoPoster->nxs_options; $options['li'][$_POST['i']]['ck'] = $ck; if (is_array($options)) { update_option('NS_SNAutoPoster', $options); } } } } if (!empty($_POST['s'])) { $seForDB = get_option('nxs_li_ctp_save'); $ser = maybe_unserialize($seForDB); $ck = $ser['c']; $flds = $ser['f']; $flds['PinVerificationForm_pinParam'] = $_POST['s']; $liObj = new nxsAPI_LI(); $hdrsArr = $liObj->headers('https://www.linkedin.com/uas/login-submit', 'https://www.linkedin.com', 'POST', true); $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); // prr($advSet); $rep = nxs_remote_post('https://www.linkedin.com/uas/ato-pin-challenge-submit', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $contents2 = $rep['body']; // prr($rep); if (stripos($contents2, 'The email address or password you provided does not match our records') !== false) { echo "Invalid Login/Password"; die; } if (stripos($contents2, '<div id="global-error">') !== false) { echo CutFromTo($contents2, '<div role="alert" class="alert error">', '</div>'); die; } if (stripos($contents2, 'Hmm, ') !== false) { echo "Invalid Login/Password"; die; } if ($rep['response']['code'] == '302' && !empty($rep['headers']['location']) && stripos($rep['headers']['location'], 'linkedin.com/uas/ato-pin-challenge-submit') !== false) { echo "Wrong Code. Please try Again"; } if ($rep['response']['code'] == '302' && !empty($rep['headers']['location']) && (stripos($rep['headers']['location'], 'linkedin.com/nhome') !== false || stripos($rep['headers']['location'], 'linkedin.com/home') !== false)) { echo "OK. You are In"; } $hdrsArr = $liObj->headers('http://www.linkedin.com/home', 'https://www.linkedin.com'); $ck = $rep['cookies']; $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck); // prr($advSet); $rep = nxs_remote_get('http://www.linkedin.com/profile/edit?trk=tab_pro', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true) . " - ERROR"; return $badOut; } $ck = $rep['cookies']; if ($_POST['i'] != '') { global $plgn_NS_SNAutoPoster; if (!isset($plgn_NS_SNAutoPoster)) { return; } $options = $plgn_NS_SNAutoPoster->nxs_options; $options['li'][$_POST['i']]['ck'] = $ck; if (is_array($options)) { update_option('NS_SNAutoPoster', $options); } } } die; }
function post($post) { $ck = $this->ck; $sslverify = false; $oneTime = '0R4qFyHCMAYYclyZQFNYrOkq4uy4mN5'; $enText = nxs_AesCtr::encrypt($post['text'], $oneTime, 256); $blogID = ''; $hdrsArr = $this->headers('http://sett.com/'); $rep = nxs_remote_get('http://sett.com/' . $post['toURL'], array('headers' => $hdrsArr, 'timeout' => 45, 'cookies' => $ck, 'httpversion' => '1.1', 'sslverify' => $sslverify)); if (is_nxs_error($rep)) { $badOut = "ERROR (Blog URL): " . print_r($rep, true); return $badOut; } $content = $rep['body']; if (stripos($content, 'window.site_id =') !== false) { $blogID = trim(CutFromTo($content, 'window.site_id =', ';')); } if (empty($blogID)) { return "ERROR (NO Blog ID found): "; } //if ($_GET('page')=='NextScripts_SNAP.php') prr($admURL); $hdrsArr = $this->headers('http://sett.com', 'http://sett.com', 'POST'); $flds = array('text' => $enText); $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'sslverify' => $sslverify, 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds); //prr($advSet); $rep = nxs_remote_post('http://sett.com/storetext.php', $advSet); if (is_nxs_error($rep)) { $badOut = "ERROR (Post Post):" . print_r($rep, true); return $badOut; } if (stripos($rep['body'], '{"id":') !== false) { $textPush = json_decode($rep['body'], true); } else { $badOut = "ERROR (Post Post):" . print_r($rep, true); return $badOut; } $pURL = 'https://sett.com/newpost.php?autosave=0&context=&is_html=&offset=&one_time=&parent_uid=&promote=&site=&submit_visible=1&to=&uid=&title=' . urlencode($post['title']) . '&url=' . $this->makeSlug($post['title']) . '&category=&allow_comments=1&allow_promoting=1&allow_indexing=1&subscribe=1&context=false&is_html=false&offset=-4&parent_uid=&promote=1&site_id=' . $blogID . '&type=post&uid=&one_time=' . $oneTime . '&text_id=' . $textPush['id'] . '&text_hash=' . $textPush['hash']; $ck = nxsClnCookies($ck); $hdrsArr = $this->headers('http://sett.com/' . $post['toURL']); $rep = nxs_remote_get($pURL, array('headers' => $hdrsArr, 'timeout' => 45, 'cookies' => $ck, 'httpversion' => '1.1', 'sslverify' => $sslverify)); if (is_nxs_error($rep)) { $badOut = "ERROR (Post Info): " . print_r($rep, true); return $badOut; } if ($rep['response']['code'] == '200') { $content = $rep['body']; if (stripos($content, '{"errors":[') !== false) { $loginArr = json_decode($content, true); $err = $loginArr['errors'][0]['title']; return "Error: " . $err . " | \r\n<br/>\r\n" . print_r($loginArr, true); } } if (stripos($rep['body'], '{"uid":') !== false) { $content = json_decode($rep['body'], true); return array('isPosted' => '1', 'postID' => $content['uid'], 'postURL' => 'http://sett.com/' . $post['toURL'] . "/" . $content['uid'], 'pDate' => date('Y-m-d H:i:s')); } return 'Error: ' . print_r($rep, true); }
function post($msg, $imgURL, $lnk, $boardID, $title = '', $price='', $via=''){ $tk = $this->tk; $ck = $this->ck; $apVer = $this->apVer; if ($this->debug) echo "[PN] Posting to ...".$boardID."<br/>\r\n"; foreach ($ck as $c) if ( is_object($c) && $c->name=='csrftoken') $tk = $c->value; $msg = strip_tags($msg); $msg = substr($msg, 0, 480); $tgs = ''; $this->tk = $tk; if ($msg=='') $msg = ' '; if (trim($boardID)=='') return "Board is not Set"; if (trim($imgURL)=='') return "Image is not Set"; $msg = str_ireplace(array("\r\n", "\n", "\r"), " ", $msg); $msg = strip_tags($msg); if (function_exists('nxs_decodeEntitiesFull')) $msg = nxs_decodeEntitiesFull($msg, ENT_QUOTES); $mgsOut = urlencode($msg); $mgsOut = str_ireplace(array('%28', '%29', '%27', '%21', '%22', '%09'), array("(", ")", "'", "!", "%5C%22", '%5Ct'), $mgsOut); $fldsTxt = 'source_url=%2Fpin%2Ffind%2F%3Furl%3D'.urlencode(urlencode($lnk)).'&data=%7B%22options%22%3A%7B%22board_id%22%3A%22'.$boardID.'%22%2C%22description%22%3A%22'.$mgsOut.'%22%2C%22link%22%3A%22'.urlencode($lnk).'%22%2C%22share_twitter%22%3Afalse%2C%22image_url%22%3A%22'.urlencode($imgURL).'%22%2C%22method%22%3A%22scraped%22%7D%2C%22context%22%3A%7B%7D%7D'; $hdrsArr = $this->headers('https://www.pinterest.com/resource/PinResource/create/ ', 'https://www.pinterest.com', 'POST', true); $hdrsArr['X-NEW-APP']='1'; $hdrsArr['X-APP-VERSION']=$apVer; $hdrsArr['X-CSRFToken']=$tk; $hdrsArr['X-Pinterest-AppState']='active'; $hdrsArr['Accept'] = 'application/json, text/javascript, */*; q=0.01'; $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $fldsTxt); $rep = nxs_remote_post('https://www.pinterest.com/resource/PinResource/create/', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR"; return $badOut; } $contents = $rep['body']; $resp = json_decode($contents, true); // prr($advSet); prr($resp); prr($fldsTxt); // prr($contents); if (is_array($resp)) { if (isset($resp['resource_response']) && isset($resp['resource_response']['error']) && $resp['resource_response']['error']!='' ) return print_r($resp['resource_response']['error'], true); elseif (isset($resp['resource_response']) && isset($resp['resource_response']['data']) && $resp['resource_response']['data']['id']!=''){ // gor JSON if (isset($resp['resource_response']) && isset($resp['resource_response']['error']) && $resp['resource_response']['error']!='') return print_r($resp['resource_response']['error'], true); else return array("isPosted"=>"1", "postID"=>$resp['resource_response']['data']['id'], 'pDate'=>date('Y-m-d H:i:s'), "postURL"=>"http://www.pinterest.com/pin/".$resp['resource_response']['data']['id']); } }elseif (stripos($contents, 'blocked this')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>')))); return "Pinterest ERROR: 'The Source is blocked'. Please see https://support.pinterest.com/entries/21436306-why-is-my-pin-or-site-blocked-for-spam-or-inappropriate-content/ for more info | Pinterest Message:".$retText; } elseif (stripos($contents, 'image you tried to pin is too small')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>')))); return "Image you tried to pin is too small | Pinterest Message:".$retText; } elseif (stripos($contents, 'CSRF verification failed')!==false) { $retText = trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>')))); return "CSRF verification failed - Please contact NextScripts Support | Pinterest Message:".$retText; } elseif (stripos($contents, 'Oops')!==false && stripos($contents, '<body>')!==false ) return 'Pinterest ERROR MESSAGE : '.trim(str_replace(array("\r\n", "\r", "\n"), " | ", strip_tags(CutFromTo($contents, '</head>', '</body>')))); else return "Somethig is Wrong - Pinterest Returned Error 502"; }
function postYT($msg, $ytUrl, $vURL = '', $ytGPPageID='') { $ck = $this->ck; $sslverify = false; $ytUrl = str_ireplace('/feed','',$ytUrl); if (substr($ytUrl, -1)=='/') $ytUrl = substr($ytUrl, 0, -1); $ytUrl .= '/feed'; $hdrsArr = $this->headers('http://www.youtube.com/'); if ($ytGPPageID!=''){ $pgURL = 'https://www.youtube.com/signin?authuser=0&action_handle_signin=true&pageid='.$ytGPPageID; if ($this->debug) echo "[YT] G SW to page: ".$ytGPPageID."<br/>\r\n"; $rep = nxs_remote_get($pgURL, array('headers' => $hdrsArr, 'httpversion' => '1.1', 'redirection' => 0, 'cookies' => $ck, 'sslverify'=>$sslverify)); if (is_nxs_error($rep)) return "ERROR: ".print_r($rep, true); if (!empty($rep['cookies'])) foreach ($rep['cookies'] as $ccN) { $fdn = false; foreach ($ck as $ci=>$cc) if ($ccN->name == $cc->name) { $fdn = true; $ck[$ci] = $ccN; } if (!$fdn) $ck[] = $ccN; } } $rep = nxs_remote_get($ytUrl, array('headers' => $hdrsArr, 'httpversion' => '1.1', 'redirection' => 0, 'cookies' => $ck, 'sslverify'=>$sslverify)); if (is_nxs_error($rep)) return "ERROR: ".print_r($rep, true); //## Merge CK if (!empty($rep['cookies'])) foreach ($rep['cookies'] as $ccN) { $fdn = false; foreach ($ck as $ci=>$cc) if ($ccN->name == $cc->name) { $fdn = true; $ck[$ci] = $ccN; } if (!$fdn) $ck[] = $ccN; } $contents = $rep['body']; $gpPageMsg = "Either BAD YouTube USER/PASS or you are trying to post from the wrong account/page. Make sure you have Google+ page ID if your YouTube account belongs to the page."; $actFormCode = 'channel_ajax'; if (stripos($contents, 'action="/c4_feed_ajax?')!==false) $actFormCode = 'c4_feed_ajax'; if (stripos($contents, 'action="/'.$actFormCode.'?')) $frmData = CutFromTo($contents, 'action="/'.$actFormCode.'?', '</form>'); else { if (stripos($contents, 'property="og:url"')) { $ytUrl = CutFromTo($contents, 'property="og:url" content="', '"').'/feed'; $rep = nxs_remote_get($ytUrl, array('headers' => $hdrsArr, 'httpversion' => '1.1', 'cookies' => $ck, 'sslverify'=>$sslverify)); if (is_nxs_error($rep)) return "ERROR: ".print_r($rep, true); if (!empty($rep['cookies'])) $ck = $rep['cookies']; $contents = $rep['body']; if (stripos($contents, 'action="/'.$actFormCode.'?')) $frmData = CutFromTo($contents, 'action="/'.$actFormCode.'?', '</form>'); else return 'OG - Form not found. - '. $gpPageMsg; } else { $eMsg = "No Form/No OG - ". $gpPageMsg; return $eMsg; } } $md = array(); $flds = array(); if ($vURL!='' && stripos($vURL, 'http')===false) $vURL = 'https://www.youtube.com/watch?v='.$vURL; $msg = strip_tags($msg); $msg = nsTrnc($msg, 500); while (stripos($frmData, '"hidden"')!==false){$frmData = substr($frmData, stripos($frmData, '"hidden"')+8); $name = trim(CutFromTo($frmData,'name="', '"')); if (!in_array($name, $md)) {$md[] = $name; $val = trim(CutFromTo($frmData,'value="', '"')); $flds[$name]= $val;} } $flds['message'] = $msg; $flds['video_url'] = $vURL; // prr($flds); $ytGPPageID = 'https://www.youtube.com/channel/'.$ytGPPageID; $hdrsArr = $this->headers($ytGPPageID, 'https://www.youtube.com/', 'POST', false); $hdrsArr['X-YouTube-Page-CL'] = '67741289'; $hdrsArr['X-YouTube-Page-Timestamp'] = date("D M j H:i:s Y", time()-54000)." (".time().")"; //'Thu May 22 00:31:51 2014 (1400743911)'; $advSet = array('headers' => $hdrsArr, 'httpversion' => '1.1', 'timeout' => 45, 'redirection' => 0, 'cookies' => $ck, 'body' => $flds, 'sslverify'=>$sslverify); //prr($advSet); $rep = nxs_remote_post('https://www.youtube.com/'.$actFormCode.'?action_add_bulletin=1', $advSet); if (is_nxs_error($rep)) { $badOut = print_r($rep, true)." - ERROR YT"; return $badOut; } $contents = $rep['body'];// prr('https://www.youtube.com/'.$actFormCode.'?action_add_bulletin=1'); prr($rep); if ($rep['response']['code']=='200' && $contents = '{"code": "SUCCESS"}') return array("isPosted"=>"1", "postID"=>'', 'postURL'=>'', 'pDate'=>date('Y-m-d H:i:s')); else return $rep['response']['code']."|".$contents; }