> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/cn/dai-li/mobile-proxies/making-requests.md).

# 发送请求

## 基础查询

基础查询只需传入 `用户名` 和 `密码`。无需其他参数。此类查询将从随机 IP 地址（代理）发起请求。每个新请求都会使用不同的代理。

### 代码示例

在此示例中，对 `ip.oxylabs.io` 的查询将从随机 IP 发出：

{% tabs %}
{% tab title="cURL" %}

```shell
curl -x pr.oxylabs.io:7777 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'pr.oxylabs.io:7777';
$query = curl_init('https://ip.oxylabs.io/location');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
    echo $output;
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
entry = ('http://customer-%s:%s@pr.oxylabs.io:7777' %
    (username, password))
query = urllib.request.ProxyHandler({
    'http': entry,
    'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read())
```

{% endtab %}

{% tab title="Java" %}

```java
package example;

import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpHost entry = new HttpHost("pr.oxylabs.io", 7777);
        String query = Executor.newInstance()
            .auth(entry, "customer-USERNAME", "PASS")
            .execute(Request.Get("http://ip.oxylabs.io/location").viaProxy(entry))
            .returnContent().asString();
        System.out.println(query);
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net;

class Example
{
    static void Main()
    {
        var client = new WebClient();
        client.Proxy = new WebProxy("pr.oxylabs.io:7777");
        client.Proxy.Credentials = new NetworkCredential("customer-USERNAME", "PASSWORD");
        Console.WriteLine(client.DownloadString("https://ip.oxylabs.io/location"));
    }
c
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'uri'
require 'net/http'

uri = URI.parse('https://ip.oxylabs.io/location')
proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME', 'PASSWORD')

req = Net::HTTP::Get.new(uri.path)

result = proxy.start(uri.host,uri.port) do |http|
    http.request(req)
end

puts result.body
```

{% endtab %}
{% endtabs %}

单个 backconnect 代理使你可以通过 username 中的附加参数选择特定国家/地区代理。这种方式还支持会话控制。下面是凭据结构示例：

`customer-USERNAME-cc-US-sessid-abcde12345:PASSWORD`

### 查询参数

| 参数                                                        | 描述                                                                                                                                                                                                                                                               |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="background-color:green;">**customer**</mark> | 用户名                                                                                                                                                                                                                                                              |
| `cc`                                                      | 不区分大小写的两字母国家代码 [**3166-1 alpha-2 格式**](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)。例如， `DE` 用于德国， `GB` 用于英国， `TH` 用于泰国。你可以找到更多关于如何使用特定国家/地区代理的详细信息 [**这里**](/products/cn/dai-li/mobile-proxies/location-settings/country.md#country-specific-entry-nodes). |
| `city`                                                    | 不区分大小写的英文城市名称。此参数必须与 `cc` 以提高准确性，例如， `cc-GB-city-london` 用于英国伦敦； `cc-DE-city-berlin` 用于德国柏林。对于超过两个词的城市，将空格替换为 `_`，例如， `city-st_petersburg` 或 `city-rio_de_janeiro`。点击 [**这里**](/products/cn/dai-li/mobile-proxies/location-settings/select-city.md) 了解更多城市级定向信息。 |
| `st`                                                      | 不区分大小写的美国州名，前缀为 us\_，例如， `us_california`, `us_illinois`. [**点击此处**](/products/cn/dai-li/mobile-proxies/location-settings/select-state.md) 了解更多州级定向信息。                                                                                                            |
| `sessid`                                                  | 用于在后续查询中保持相同 IP 的会话 ID。会话在 10 分钟后过期。之后会为该会话 ID 分配新的 IP 地址。支持随机字符串、0-9 以及 A-Z 字符。                                                                                                                                                                                 |
| `sesstime`                                                | 会话时间参数会在一定时间内保持相同 IP。最大会话时长为 30 分钟。                                                                                                                                                                                                                              |
| <mark style="background-color:green;">**密码**</mark>       | 密码                                                                                                                                                                                                                                                               |

&#x20;     \- 必填参数

## 中国入口节点

我们已在香港和北京地区配置入口节点，以便从中国获得更好的连接。请注意，这是一个 HTTPS 代理节点。所有 username 参数都与常规入口节点相同。

我们目前正在修复其余集成，届时将支持 HTTPS 协议。

```
https://a81298871.com:8000 - 香港
```

<pre><code><strong>https://cnt9t1is.com:8000 - 北京
</strong></code></pre>

{% tabs %}
{% tab title="cURL" %}

```shell
curl -x pr.oxylabs.io:7777 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'pr.oxylabs.io:7777';
$query = curl_init('https://ip.oxylabs.io/location');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
    echo $output;
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
entry = ('http://customer-%s:%s@pr.oxylabs.io:7777' %
    (username, password))
query = urllib.request.ProxyHandler({
    'http': entry,
    'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read())
```

{% endtab %}

{% tab title="Java" %}

```java
package example;

import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpHost entry = new HttpHost("pr.oxylabs.io", 7777);
        String query = Executor.newInstance()
            .auth(entry, "customer-USERNAME", "PASS")
            .execute(Request.Get("http://ip.oxylabs.io/location").viaProxy(entry))
            .returnContent().asString();
        System.out.println(query);
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net;

class Example
{
    static void Main()
    {
        var client = new WebClient();
        client.Proxy = new WebProxy("pr.oxylabs.io:7777");
        client.Proxy.Credentials = new NetworkCredential("customer-USERNAME", "PASSWORD");
        Console.WriteLine(client.DownloadString("https://ip.oxylabs.io/location"));
    }
c
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'uri'
require 'net/http'

uri = URI.parse('https://ip.oxylabs.io/location')
proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME', 'PASSWORD')

req = Net::HTTP::Get.new(uri.path)

result = proxy.start(uri.host,uri.port) do |http|
    http.request(req)
end

puts result.body
```

{% endtab %}
{% endtabs %}

如果你从中国连接我们的移动网络，并且提供的入口节点仍有问题，请与我们联系 [**support@oxylabs.io**](mailto:support@oxylabs.io)，我们会一起找到解决方案。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/products/cn/dai-li/mobile-proxies/making-requests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
