2013-07-18 23 views
10

curlのリクエストをpinterest.comに送信しています。 PHPを使用すると結果が表示されません。私はコマンドラインから試してみましたが、結果は表示されませんでした。それから私はcurlで冗長モードを試してみましたが、それが与える:cURL GETリクエストは返信なし出力

curl 7.27.0 (i686-pc-linux-gnu) libcurl/7.27.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25 librtmp/2.3 
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp 
Features: Debug GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

私が検索しましたが、整理ができませんでした。私は間違って何をしていますか?

コマンドは次のとおりです。

curl -v pinterest.com 
+0

あなたがテストに使用している正確なコマンドを提供するように編集してください。 –

+1

@jcomeau_ictx:提供 –

答えて

27

は、ヘッダーを確認します。それは、HTTPSによってのみアクセス可能です:

$ curl --dump-header - http://pinterest.com/ 
HTTP/1.1 302 FOUND 
Accept-Ranges: bytes 
Age: 0 
Content-Type: text/html; charset=utf-8 
Date: Thu, 18 Jul 2013 19:25:49 GMT 
Etag: "d41d8cd98f00b204e9800998ecf8427e" 
Location: https://pinterest.com/ 
Pinterest-Breed: CORGI 
Pinterest-Generated-By: ngapp-b7f64694 
Pinterest-Version: a8eef3c 
Server: nginx/0.8.54 
Set-Cookie: csrftoken=A2VQZGarr509JKxrJxiuW2MbrXNdHlUH; Domain=.pinterest.com; expires=Thu, 17-Jul-2014 19:25:49 GMT; Max-Age=31449600; Path=/ 
Set-Cookie: _pinterest_sess="eJwz84isyvfJcilP1S4szHY20A6MKitJKwwPdi+2tY8vycxNtfUN8TX2c3E19gsJNfAPtLVVK04tLs5MsfXMcjTxq/KsAGJj3/CgHL+QoGzfrLCMSKNAIz93X+PIrHQTIF0eFe6X4ZluawsAh3UjNA=="; Domain=.pinterest.com; expires=Sun, 13-Jul-2014 19:25:49 GMT; Max-Age=31103999; Path=/ 
Vary: Cookie 
Via: 1.1 varnish 
X-Varnish: 1991078486 
Content-Length: 0 
Connection: keep-alive 

あなたが-Lオプションを使用する場合は、ページを取得します:

$ curl -L http://pinterest.com/ 
<!DOCTYPE html> 
<!--[if IE 7 ]><html lang="en" class="ie7 ielt9 ielt10 en"><![endif]--> 
<!--[if IE 8 ]><html lang="en" class="ie8 ielt9 ielt10 en"><![endif]--> 
<!--[if IE 9 ]><html lang="en" class="ie9 ielt10 en"><![endif]--> 
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class=" en"><!--<![endif]--> 

<head> 
    <script> 
[snip] 

ここでthis linkはPHPでどのように処理されたのですか:

[年後...]また、-V--versionで、--verboseではなく、-vです。 curl -Vを呼び出すとバージョンが表示され、はすべてののargsを無視するので、とにかくそのページを得ることはありません。

+0

それは私に与えます :〜$ curl -D http://pinterest.com/ カール:URLが指定されていません! curl:詳細については、 'curl --help'または 'curl --manual'を試してください。 提案がありますか? \ –

+1

私のカットアンドペーストをボルケー。一時的に修正されます。 –

+1

-Dはargを必要としますが、stdoutには ' - 'を指定できます。カットアンドペーストで問題に気づいたが、それを捕まえなかった。申し訳ありません。 –

関連する問題