Help! Webscraping With PHP Curl Is Not Working - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help! Webscraping With PHP Curl Is Not Working (335 Views)
| Help! Webscraping With PHP Curl Is Not Working by Moonlight111(op): 9:37am On Mar 31, 2024 |
Hello programmers, I have a website where i sell and receive payment via flutterwave. I have been using curl for months to get payment information from my payment gateway (Flutterwave) and it works fine. All of a sudden it started giving me this error Failed to connect to api.flutterwave.com port 443 after 1103 ms: Couldn't connect to server Here is my code public function getBankName(){ $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.flutterwave.com/v3/banks/NG", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "Authorization: Bearer MY_SECRET_KEY" ) )); $response = curl_exec($curl); if (curl_errno($curl)) { echo curl_error($curl).$this->eror; print_r(curl_getinfo($curl)); } curl_close($curl); $response = json_decode($response); $banknames = array(); if($response = json_decode(json_encode($response), true)){ for($i=0; $i<sizeof($response['data']); $i++){ $banknames[] = $response['data'][$i]['name']; } return $banknames; } else{ return false; } } |
| Re: Help! Webscraping With PHP Curl Is Not Working by Mrviktor(m): 9:45am On Mar 31, 2024 |
Senior man this endpoint is to get bank name nd codes |
| Re: Help! Webscraping With PHP Curl Is Not Working by Moonlight111(op): 9:47am On Mar 31, 2024 |
Mrviktor:Yes and it has stopped working. |
| Re: Help! Webscraping With PHP Curl Is Not Working by chukwuebuka65(m): 11:50am On Mar 31, 2024 |
It could be from flutterwave. |
| Re: Help! Webscraping With PHP Curl Is Not Working by Moonlight111(op): 12:10pm On Mar 31, 2024 |
chukwuebuka65:i have sent them emails, no go solution yet |
| Re: Help! Webscraping With PHP Curl Is Not Working by Mrviktor(m): 4:52pm On Mar 31, 2024 |
Moonlight111:U can hardcode it for now.. nd test the endpoint with postman. I don't think there has been any new banks in the past year or two.. |
| Re: Help! Webscraping With PHP Curl Is Not Working by stanliwise(m): 9:04pm On Mar 31, 2024 |
If it was a problem with curl then try it locally using postman |
| Re: Help! Webscraping With PHP Curl Is Not Working by Moonlight111(op): 9:04pm On Mar 31, 2024 |
Thanks to all those who responded, it started working on it's own. |
| Re: Help! Webscraping With PHP Curl Is Not Working by Shedrick: 12:38pm On Apr 03, 2024 |
Next time just know it is a problem from the second party server side. |
I Built A Lpg Gas Station Sales Software Script With Php. • Who Knows How To Login Nairaland With Php/curl • Problems Using Php Curl • 2 • 3 • 4
Done • Become An Ethical Hacking & Cybersecurity Pro! • Affordable "Dell" Laptop For Sale