Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rider's avatar
Level 1

Stripe CURL request

Iam trying to make CURL request to get customer from stripe not using any library, iam receiving empty result, can anyone please help me to solve this one, curl looks like

 $url ="https://api.stripe.com/v1/customers?limit=3 \
    -u sk_test_3iIP8u46agjTQ2vPau9oAji5: \
    -G";

$ch = curl_init(); //open connection
curl_setopt($ch, CURLOPT_URL, $url);
$result_count = curl_exec($ch); //execute post

echo"<pre>";
print_r($result_count);
exit;
0 likes
3 replies
rider's avatar
Level 1

This is the CURL now iam trying as per your example but it remains the same, and now i have trying to make an invoice to "past due" stage "void" stage still iam receiving empty result while i check the invoice in stripe it doesn't change

$url ="https://api.stripe.com/v1/invoices/
    in_1EuGWwI0fZrJ7D07tPYOAOHM/void \
    -u sk_test_3iIP8u46agjTQ2vPau9oAji5: \
    -X";

   $ch = curl_init(); //open connection
   curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13");
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt($ch, CURLOPT_TIMEOUT, 180);
   $result_count = curl_exec($ch); //execute post
   echo"<pre>";
   print_r($result_count);
   exit;
click's avatar

When in doubt, debug: https://stackoverflow.com/questions/3757071/php-debugging-curl

I don't know the API of stripe so can't help you with that but this comes down to basic debuggin in the first place I would say.

  • What http status do you receive?
  • Is the URL correct?
  • Is the method correct (Shouldn't you do a PUT,POST,DELETE request?)
1 like

Please or to participate in this conversation.