私自身が私の人生を大幅に簡素化し、メールのチェックからテレビバンクでのデータのダウンロードまで、すべてを自動化するために使用している方法に注目します。 Yandex.mailの例を使用して、非常に迅速かつほとんどプログラミングなしでカールPHPスクリプトを生成し、任意のサイトに移動してコンテンツを自動的にダウンロードする方法を示します。
まず、Firefoxブラウザー用のFirebug拡張機能をインストールする必要があります。 その後、FireBug NetExportの拡張機能をインストールします
netExportの最新バージョンでは、アクションのネットワークログをHTTPアーカイブ形式で自動的に収集できます
興味のあるサイトに移動します。この場合はmail.yandex.ruになります。 その後、すべてのCookieとブラウザキャッシュをクリアすることをお勧めします。 ブラウザのステータスバーのバグアイコンをクリックして、FireBugを有効にします。 次に、念のため、ネットワークをオンにし、キャッシュをオフにします。

NetExportプラグインがインストールされている場合、Firebugパネルに「エクスポート」ボタンとその横に黄色い丸が表示されます。 プラグインがすべてのアクションを自動モードで記録するには、ログのデフォルトディレクトリを設定し、黄色の丸をクリックする必要があります(図のように緑色に変わります)。

今、あなたのアカウントの下に行き、あなたが必要なアクションを実行してください。 私の場合は、ログインして、文字でページに移動するだけです。 完了、緑色の円をクリックしてNetExportを停止します。 デフォルトで選択したフォルダに、いくつかのファイルが表示されました。 オンラインビューアーを使用して分析し、自動化のためのコードを記述できます。
ただし、これを自動的に実行できる小さなサービスを作成しました。 リンクhar2php.sharecoder.comをクリックすると、ログファイルをサービスにアップロードするだけで、PHPコードが書き込まれます。 私の場合、「passport-ckicheck.yandex.ru + 2010-02-18 + 10-15-21.har」というファイルをアップロードする必要があります:)このサービスは自分で行ったため、大きなログファイルをうまく消化できません。しかし、彼は彼のビジネスをよく知っています。 サービスは送信されたデータを保存せず、現在のセッションでのみ保持します。 ただし、セキュリティを強化するために、HARファイルをサービスに送信する前に、実際のユーザー名とパスワードをいくつかの文字に置き換えることをお勧めします。
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
Copy Source | Copy HTML $cookie_file = 'cookie.txt' ; $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, 'https://passport.yandex.ru/passport?mode=auth' ); curl_setopt( $ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6' ); curl_setopt( $ch , CURLOPT_REFERER, 'http://mail.yandex.ru/' ); curl_setopt( $ch , CURLOPT_ENCODING, 'gzip,deflate' ); curl_setopt( $ch , CURLOPT_COOKIEJAR, $cookie_file ); curl_setopt( $ch , CURLOPT_COOKIEFILE, $cookie_file ); $header = array (); $header [] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ; $header [] = 'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7' ; $header [] = 'Accept-Language: ru,en-us;q=0.7,en;q=0.3' ; $header [] = 'Pragma: ' ; curl_setopt( $ch , CURLOPT_HTTPHEADER, $header ); curl_setopt( $ch , CURLOPT_POST, true ); $fields = array (); $fields [] = 'login=xxxxx' ; $fields [] = 'passwd=xxxxx' ; $fields [] = 'retpath=xxxxx' ; $fields [] = 'twoweeks=yes' ; curl_setopt( $ch , CURLOPT_POSTFIELDS, implode( '&' , $fields )); curl_setopt( $ch , CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch , CURLOPT_AUTOREFERER, true ); curl_exec( $ch ); curl_close( $ch );
コードは、いくつかの表面的な変更の後、意図したとおりに使用できます:)
PSまだサイトにログを送信することを恐れている人のために、私はサービスの現在のバージョンのソースコードを開きます:
Copy Source | Copy HTML
- <?php
- $ data = implode( '' 、file( $ uploadfile ));
- $ data = json_decode( $ data );
- リンク解除( $ uploadfile );
- $ lines = parseData( $ data );
- 関数 parseData( $ data )
- {
- $行 = 配列 ();
- foreach ( $ data- > { 'log' }-> { 'pages' } as $ page ){
- $ exclude_url = array ();
- foreach ( $ data- > { 'log' }-> { 'entries' } as $ entrie ){
- if ( $ entrie- > { 'pageref' }!= $ page- > { 'id' }) continue ;
- if (! empty ( $ exclude_url [ $ entrie- > { 'request' }-> { 'url' }])) continue ;
- if ( falseおよび preg_match( '/\d+-\d+-\d+T\d+:\d+:\d+\.(\d+)/'、$ entrie- > { 'startedDateTime' }、 $ m )){
- $ id = strftime( '%Y%m%d%H%M%S' 、strtotime( $ entrie- > { 'startedDateTime' }))。 $ m [ 1 ];
- } else {
- $ id = $ entrie- > { 'startedDateTime' };
- }
- $行 [ $ id ] [] = '$ cookie_file = \' cookie.txt \ ';' ;
- $行 [ $ id ] [] = '' ;
- $ headers = array ();
- foreach ( $ entrie- > { 'request' }-> { 'headers' } as $ header ){
- $ headers [ $ header- > { 'name' }] = $ header- > { 'value' };
- }
- $行 [ $ id ] [] = '$ ch = curl_init();' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_URL、\' ' 。 $ entrie- > { ' request ' }-> { ' url ' }。 ' \ ');' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_USERAGENT、\' ' 。 $ headers [ ' User-Agent ' ]。 ' \ ');' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_REFERER、\' ' 。 $ headers [ ' Referer ' ]。 ' \ ');' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_ENCODING、\' ' 。 $ headers [ ' Accept-Encoding ' ]。 ' \ ');' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_COOKIEJAR、$ cookie_file);' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_COOKIEFILE、$ cookie_file);' ;
- $行 [ $ id ] [] = '' ;
- $ lines [ $ id ] [] = '$ header = array();' ;
- $ lines [ $ id ] [] = '$ header [] = \' Accept: ' $ヘッダー [ 'Accept' ]。 '\'; ' ;
- $ lines [ $ id ] [] = '$ header [] = \' Accept-Charset: ' 。 $ヘッダー [ 'Accept-Charset' ]。 '\'; ' ;
- $ lines [ $ id ] [] = '$ header [] = \' Accept-Language: ' 。 $ヘッダー [ 'Accept-Language' ]。 '\'; ' ;
- $ lines [ $ id ] [] = '$ header [] = \'プラグマ:\ ';' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_HTTPHEADER、$ header);' ;
- スイッチ ( $ entrie- > { 'request' }-> { 'method' }){
- ケース 「GET」 :
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_POST、false);' ;
- 休憩 ;
- ケース 「POST」 :
- if ( $ entrie- > { 'request' }-> { 'postData' }-> { 'mimeType' } == 'application / x-www-form-urlencoded' ){
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_POST、true);' ;
- } else {
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_POST、false);' ;
- }
- $行 [ $ id ] [] = '' ;
- $ lines [ $ id ] [] = '$ fields = array();' ;
- foreach ( $ entrie- > { 'request' }-> { 'postData' }-> { 'params' } as $ param ){
- $行 [ $ id ] [] = '$フィールド[] = \' ' $ param- > { 'name' }。 '=' 。 $ param- > { '値' }。 '\'; ' ;
- }
- $行 [ $ id ] [] = '' ;
- $ lines [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_POSTFIELDS、implode(\'&\ '、$ fields));' ;
- 休憩 ;
- デフォルト :
- die (print_r( $ entrie ));
- }
- if ( $ entrie- > { 'response' }-> { 'status' } == '302' ){
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_FOLLOWLOCATION、true);' ;
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_AUTOREFERER、true);' ;
- $ exclude_url [ $ entrie- > { 'response' }-> { 'redirectURL' }] = true ;
- } else {
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_FOLLOWLOCATION、false);' ;
- $行 [ $ id ] [] = 'curl_setopt($ ch、CURLOPT_AUTOREFERER、false);' ;
- }
- $行 [ $ id ] [] = 'curl_exec($ ch);' ;
- $行 [ $ id ] [] = 'curl_close($ ch);' ;
- $行 [ $ id ] [] = '' ;
- }
- }
- $行を 返します。
- }
- ?>