API Carian Jalur: Ralat Permintaan - 400 Permintaan Buruk
P粉268654873
P粉268654873 2023-09-03 19:39:18
0
1
436

我正在尝试在 PHP 中执行 cURL 来执行 Stripe 订阅搜索。但我收到 400 Bad Request。

这是我的 PHP 脚本:

$ch = curl_init(); $created = 'dicipta<' . strtotime('esok'); $next_page=isset($_REQUEST['next_page'])==true?'page='.$_REQUEST['next_page']:''; $had = 20; $curl_url = "https://api.stripe.com/v1/subscriptions/search?".$next_page."&expand[]=total_count&limit=".$limit."&query =status:'aktif' DAN metadata['order_id']:'6735'".'DAN '.$created; //"https://api.stripe.com/v1/subscriptions/search?&expand[]=total_count&limit=20&query=status:'aktif' DAN metadata['order_id']:'6735' DAN mencipta<1672272000" curl_setopt($ch, CURLOPT_URL, $curl_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); $headr = array(); $headr[] = 'Versi-Stripe: 15-11-2022'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headr); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, 'XXXX-secret_key_test-XXX'); $respon = curl_exec($ch); curl_close($ch);

P粉268654873
P粉268654873

membalas semua (1)
P粉493313067

Saya menyelesaikan masalah ini dengan mengekodkan nilai parameter pertanyaan

$curl_url = "https://api.stripe.com/v1/subscriptions/search?".$next_page."&expand[]=total_count&limit=".$limit ."&query=".urlencode($status.' AND '.$created)`
    Muat turun terkini
    Lagi>
    kesan web
    Kod sumber laman web
    Bahan laman web
    Templat hujung hadapan
    Tentang kita Penafian Sitemap
    Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!