SportScore

פרמיום
Verified
על ידי Tipsters CO | מְעוּדכָּן 5 days ago | Sports
פּוֹפּוּלָרִיוּת

9.9 / 10

חֶבִיוֹן

134ms

רמת שירות

100%

Health Check

100%

חזרה לכל הדיונים

POST request not working

Rapid account: Cedk
cedk
2 years ago

Hi, today the POST request /teams/search?sport_id=3&country=France is not working (using CURL in PHP).

I don’t understand why the response is a HTTP/1.1 400 Bad Request.


Trying 3.226.33.234:443…

  • Connected to sportscore1.p.rapidapi.com (3.226.33.234) port 443 (#0)
  • ALPN, offering http/1.1
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  • ALPN, server accepted to use http/1.1
  • Server certificate:
  • subject: CN=*.p.rapidapi.com
  • start date: Jul 6 00:00:00 2022 GMT
  • expire date: Aug 4 23:59:59 2023 GMT
  • subjectAltName: host “sportscore1.p.rapidapi.com” matched cert’s “*.p.rapidapi.com”
  • issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
  • SSL certificate verify ok.

POST /teams/search?sport_id=3&country=France HTTP/1.1
Host: sportscore1.p.rapidapi.com
Accept: /
Accept-Encoding: deflate, gzip, br
X-RapidAPI-Host: sportscore1.p.rapidapi.com
X-RapidAPI-Key: ****

  • Mark bundle as not supporting multiuse
    < HTTP/1.1 400 Bad Request
    < Date: Wed, 17 Aug 2022 11:10:53 GMT
    < Content-Type: text/plain; charset=UTF-8
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < X-RateLimit-Requests-Limit: 500
    < X-RateLimit-Requests-Remaining: 301
    < X-RateLimit-Requests-Reset: 187629
    < Server: RapidAPI-1.2.8
    < X-RapidAPI-Version: 1.2.8
    < X-RapidAPI-Region: AWS - us-east-1
    <
  • Connection #0 to host sportscore1.p.rapidapi.com left intact
    string(0) “”
Rapid account: Donald Steve
DonaldSteve Commented 2 months ago

FINALLY I GOT MY LOST BITCOIN BACK FROM SCAMMERS: Hello, I wilI highly recommend the services of hackersteve911 to anyone who wishes to recover their lost money either bitcoin or other cryptocurrencies from these online scammers, wallet hackers, or if you ever sent bitcoins to the wrong wallet address. I was able to recover my lost bitcoins from online swindlers in less than 24 hours after contacting them. They are the best professional hackers out there and I’m truly thankful for their help in recovering all I lost. If you need their service too, here is their contact information: hackersteve911@gmail.com

Rapid account: Tipsters
tipsters Commented 2 years ago

ok!

Rapid account: Cedk
cedk Commented 2 years ago

OK I found the problem.

The example code is incorrect, the post data must be passed as a query string in the CURLOPT_POSTFIELDS field, not in the enpoint URL as suggested.

<?php

$curl = curl_init();

$data = [
	'sport_id' => 3,
	'country' => 'France'
];

$post_data = http_build_query($data);

curl_setopt_array($curl, [
	CURLOPT_URL => "https://sportscore1.p.rapidapi.com/players/search",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_FOLLOWLOCATION => true,
	CURLOPT_ENCODING => "",
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 30,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => "POST",
	CURLOPT_HTTPHEADER => [
		"X-RapidAPI-Host: sportscore1.p.rapidapi.com",
		"X-RapidAPI-Key: ***"
	],
	CURLOPT_POSTFIELDS => $post_data
]);

$response = curl_exec($curl);
$err = curl_error($curl);
$info = curl_getinfo($curl, CURLINFO_HTTP_CODE);

var_dump('info', $info);
var_dump('response', $response);
var_dump('err', $err);

curl_close($curl);


הצטרף לדיון - הוסף תגובה למטה:

התחבר / הירשם כדי לפרסם תגובות חדשות