コード例 #1
0
 /**
  * 得到公众号的AppId和AppSecret,本地可以,服务器失败
  * @return Ambigous <unknown, string>
  */
 public function getAppIdSecret()
 {
     $url = "https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=" . GetWeiXinCookie::$token . "&lang=zh_CN";
     $c = new MyCurl($url);
     $c->setCookie(GetWeiXinCookie::$cookie);
     $c->createCurl();
     $body = $c->getCurlBody();
     if ($this->debug) {
         echo '<br />得到公众号的AppId和AppSecret getHttpStatus:' . $c->getHttpStatus();
         echo '<br />得到公众号的AppId和AppSecret cookie:' . GetWeiXinCookie::$cookie;
         echo '<br />得到公众号的AppId和AppSecret url:' . $url;
         echo '<br />得到公众号的AppId和AppSecret body:' . $body;
     }
     if ($c->getHttpStatus() != "200") {
         //CURLE_SSL_CONNECT_ERROR(35)出现问题的地方,在SSL / TLS握手。你真正想要的的错误缓冲区和阅读邮件,因为它针对问题稍微。可能是证书(文件格式,路径,权限),密码,和其他人
         echo '<br />得到公众号的AppId和AppSecret CURL错误信息:' . $c->getCurlError();
     }
     preg_match("/\\{name:\"AppId\",value:\"(\\w*?)\"\\},\\s*?\\{name:\"AppSecret\",value:\"(\\w*?)\"\\}/", $body, $out);
     return array('appId' => $out[1], 'appSecret' => $out[2]);
 }
コード例 #2
0
ファイル: index.php プロジェクト: danicheman/urlchecker
if (!empty($_POST['url'])) {
    //if the url doesn't start with http then add it
    if (strpos($_POST['url'], 'http') !== 0) {
        $_POST['url'] = "http://" . $_POST['url'];
    }
    //set defaults for json response array
    $response['tagCount'] = array();
    $response['html'] = "";
    $response['code'] = "N/A";
    $response['message'] = "";
    //use php's filter to check for a valid url
    if (!filter_var($_POST['url'], FILTER_VALIDATE_URL) === false) {
        $url = $_POST['url'];
        $curl = new MyCurl($url);
        $curl->createCurl();
        $response['code'] = $curl->getHttpStatus();
        $response['message'] = HttpCodes::getType($response['code']);
        $html = $curl->__toString();
        if (!is_string($html)) {
            $response['message'] = "Page Could not be loaded, check the domain. Nothing was returned.";
        } else {
            $tidy = new Tidy();
            //load page into tidy object, set options, and clean html
            $tidy->parseString($html, array('indent' => 2, 'output-xhtml' => true));
            $tidy->cleanRepair();
            //html is now nicely indented
            $html = (string) $tidy;
            //count the tags and get the result in a $tag => $count array
            $tagCount = countTags($html);
            $response['tagCount'] = $tagCount;
            $response['html'] = htmlentities($html);
コード例 #3
0
ファイル: setadvanced.php プロジェクト: q546530715/fenzhi-git
 public function advancedswitchform()
 {
     $url = "https://mp.weixin.qq.com/misc/skeyform?form=advancedswitchform&lang=zh_CN";
     //关闭编辑模式
     $post_query = http_build_query(array('flag' => 0, 'type' => 1, 'token' => $this->_token));
     $MyCurl2 = new MyCurl($url);
     $MyCurl2->setCookie(GetWeiXinCookie::$cookie);
     $MyCurl2->setPost($post_query);
     $MyCurl2->setReferer("https://mp.weixin.qq.com/advanced/advanced?action=edit&t=advanced/edit&token=" . $this->_token . "&lang=zh_CN");
     $MyCurl2->createCurl();
     $res2 = $MyCurl2->getCurlResult();
     if ($this->debug) {
         echo "关闭公众号的编辑模式httpresult:<br/>" . $res2 . "<br/>";
         echo '关闭公众号的编辑模式 TOKEN' . $this->_token;
     }
     if ($MyCurl2->getHttpStatus() != "200") {
         echo "关闭公众号的编辑模式, 失败";
         echo $res2;
         exit;
     }
     //开启开发者模式
     $post_query1 = http_build_query(array('flag' => 1, 'type' => 2, 'token' => $this->_token));
     $MyCurl1 = new MyCurl($url);
     $MyCurl1->setCookie(GetWeiXinCookie::$cookie);
     $MyCurl1->setPost($post_query1);
     $MyCurl1->setReferer("https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=" . $this->_token . "&lang=zh_CN");
     $MyCurl1->createCurl();
     $res1 = $MyCurl1->getCurlResult();
     if ($this->debug) {
         echo "开启公众号的开发者模式httpresult:<br/>" . $res1 . "<br/>";
         echo "开启公众号的开发者模式TOEKN:" . $this->_token;
     }
     if ($MyCurl1->getHttpStatus() != "200") {
         echo "开启公众号的开发者模式失败";
         echo $res1;
         exit;
     }
 }