Skip to content

Commit

Permalink
Fix and port to support new version of bonbast.com #9, #8, #7
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Sep 4, 2024
1 parent 19210b2 commit 219e939
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/bonbast-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private function extractKeyFromHomePage($homepage)
/**
* Extract "body parameters" which are hard coded in homepage response
*/
preg_match('/data\:"(.*?)"/s', $homepage, $matches);
preg_match('/json\'\, \{param\: \"([^\"]+)\"/s', $homepage, $matches);

// Couldn't extract the API key from homepage source.
if (!isset($matches[1])) throw new BadHomepageDataException();
Expand All @@ -128,7 +128,7 @@ private function requestFetchPrices($key)
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_TIMEOUT => 0,
CURLOPT_POSTFIELDS => "data=" . $key . "&webdriver=false",
CURLOPT_POSTFIELDS => "param=" . $key,
CURLOPT_HTTPHEADER => [
"user-agent: " . $this->user_agent,
"content-type: application/x-www-form-urlencoded; charset=UTF-8",
Expand Down

0 comments on commit 219e939

Please sign in to comment.