# 几分钟内的智能代理

如果您的应用程序未设计为使用基于 HTTP/S 的 API 来抓取和抓取网站(如 Crawling API),我们设计了一个智能旋转代理,可将您的请求转发到 Crawling API。 您只需将其用作应用程序中的普通代理即可。

所有代理调用都应该转到 http://smartproxy.crawlbase.com 和端口 8012 使用您的访问令牌作为代理用户名。

因此,拨打您的第一个电话就像在终端中运行以下行一样简单。 继续尝试!

curl -x "http://[email protected]:8012" -k "http://httpbin.org/ip"

# 如何运作的?

当您向代理发送请求时,代理将使用您的代理授权用户名和下面的私有访问令牌来授权您的请求。 然后它将您的请求重定向到 Crawling API,然后将响应返回给您的应用程序。 如果您需要在此模式下使用 Crawling API 的额外功能,则需要发送 HTTP 标头 crawlbaseAPI-Parameters 并发送您需要使用的选项。 查看下面的示例部分以获取真实示例。

私人代币

_USER_TOKEN_

# 重要注意事项

使用智能代理时禁用 SSL 验证很重要,否则,我们将无法根据您的请求执行我们的智能 AI 集成。 因此,您应该跳过验证证书。

# 请求示例

  • curl
  • ruby
  • node
  • php
  • python
  • go
// GET request

curl -x "http://[email protected]:8012" -k "http://httpbin.org/ip"

// GET request with custom UserAgent and returning original headers

// Make use of the API parameters, like store=true, device=mobile, get_cookies=true and etc.

// Example of using a custom user agent and storing a copy of the result in Crawlbase Cloud storage.

curl -H "CrawlbaseAPI-Parameters: get_headers=true&store=true&user_agent=Mozilla%2F5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F91.0.4472.124%20Safari%2F537.36" \
-x "http://[email protected]:8012" \
-k "http://httpbin.org/headers"

// GET request with headless browser (JavaScript Enabled)

curl -H "CrawlbaseAPI-Parameters: javascript=true" -x "http://[email protected]:8012" \
-k "http://httpbin.org/anything"

// POST form request
curl -H 'Content-Type: application/x-www-form-urlencoded' \
-F 'param=value' \
-X POST \
-x "http://[email protected]:8012" \
-k "http://httpbin.org/anything"

// POST JSON request
curl -H "accept: application/json" \
--data '{"key1":"value1","key2":"value2"}' \
-X POST \
-x "http://[email protected]:8012" \
-k "http://httpbin.org/anything"