{"id":1527,"date":"2014-10-23T14:36:57","date_gmt":"2014-10-23T14:36:57","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=1527"},"modified":"2014-10-23T14:36:57","modified_gmt":"2014-10-23T14:36:57","slug":"%e4%bc%aa%e9%80%a0ip%e8%ae%bf%e9%97%ae%e6%9d%a5%e6%ba%90","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/1527.html","title":{"rendered":"\u4f2a\u9020IP\u8bbf\u95ee\u6765\u6e90"},"content":{"rendered":"<p>\u5185\u5bb9\u5f88\u7b80\u5355\uff0c\u5148\u8bb0\u4e0b\u6765\uff0c\u65b9\u4fbf\u67e5\u9605\uff1a<\/p>\n<ul>\n<li><strong>\u4f2a\u9020<\/strong><strong>IP<\/strong><strong>\u7684<\/strong><strong>PHP<\/strong><strong>\u4ee3\u7801<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">&lt;?php\n    $ch = curl_init();\n    $url = \"http:\/\/localhost\/target_ip.php\";\n    $header = array(\n        'CLIENT-IP:58.68.44.61',\n        'X-FORWARDED-FOR:58.68.44.61',\n    );\n    curl_setopt($ch, CURLOPT_URL, $url);\n    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    $page_content = curl_exec($ch);\n    curl_close($ch);\n    echo $page_content;\n?&gt;<\/pre>\n<ul>\n<li><strong>\u672c\u5730\u5224\u65ad\u6765\u8bbf<\/strong><strong>IP<\/strong><strong>\u7684<\/strong><strong>PHP<\/strong><strong>\u4ee3\u7801<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">&lt;?php\n    echo getenv('HTTP_CLIENT_IP').\"n\";\n    echo getenv('HTTP_X_FORWARDED_FOR').\"n\";\n    echo getenv('REMOTE_ADDR').\"n\";\n?&gt;<\/pre>\n<ul>\n<li><strong>\u4f2a\u9020<\/strong><strong>IP<\/strong><strong>\u8bbf\u95ee\u7f51\u7ad9<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">&lt;?php\nfor ($i = 0; $i &lt; 5; $i++) {\n    task();\n}\nfunction task() {\n    $url = \"http:\/\/www.xxx.com\/?fromuid=272539\";\n    $ip = \"100.100.\".rand(1, 255).\".\".rand(1, 255);\n    $headers = array(\"X-FORWARDED-FOR:$ip\");\n\n    $curl = curl_init($url);\n    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);\n    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n    curl_setopt($curl, CURLOPT_USERAGENT,  \"Mozilla\/4.0\");\n    $src = curl_exec($curl);\n    curl_close($curl);\n}\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h6><strong>\u53c2\u8003\u94fe\u63a5\uff1a<\/strong><\/h6>\n<ul>\n<li><a href=\"http:\/\/www.jb51.net\/article\/31694.htm\" target=\"_blank\">php curl \u4f2a\u9020IP\u6765\u6e90\u7684\u5b9e\u4f8b\u4ee3\u7801_php\u6280\u5de7<\/a><\/li>\n<li><a href=\"http:\/\/www.poboke.com\/study\/curl-forge-ip-to-visit-the-website.html\" target=\"_blank\">curl\u4f2a\u9020ip\u8bbf\u95ee\u7f51\u7ad9<\/a><\/li>\n<li><a href=\"http:\/\/segmentfault.com\/q\/1010000000095850\" target=\"_blank\">\u5982\u4f55\u907f\u514d\u7528\u6237\u8bbf\u95ee\u8bf7\u6c42\u4f2a\u9020ip<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/5835093\/can-serverremote-addr-be-trusted\" target=\"_blank\">php &#8211; Can $_SERVER[&#8216;REMOTE_ADDR&#8217;] be trusted? &#8211; Stack Overflow<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5185\u5bb9\u5f88\u7b80\u5355\uff0c\u5148\u8bb0\u4e0b\u6765\uff0c\u65b9\u4fbf\u67e5\u9605\uff1a \u4f2a\u9020IP\u7684PHP\u4ee3\u7801 &lt;?php $ch = curl_init(); [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[378,48,379,380],"class_list":["post-1527","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","tag-http_client_ip","tag-php","tag-remote_addr","tag-x-forwarded-for"],"views":2442,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=1527"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1527\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=1527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=1527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=1527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}