Skip to content

Commit

Permalink
:octocat: CurlHandle/CurlMultiClient rework
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Mar 13, 2024
1 parent 0effae2 commit 352ad48
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 627 deletions.
11 changes: 6 additions & 5 deletions examples/curl_multi.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@

public function handleResponse(
ResponseInterface $response,
RequestInterface $request,
int $id,
array $curl_info,
RequestInterface $request,
int $id,
array|null $curl_info,
):RequestInterface|null{

// the API returns either 200 or 206 on OK responses
Expand All @@ -80,8 +80,9 @@ public function handleResponse(

// create a file for each item in the response (ofc you'd rather put this in a DB)
foreach($json as $item){
$file = $lang.'/'.$item->id;
file_put_contents(__DIR__.'/'.$file.'.json', json_encode($item, (JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)));
$file = sprintf('%s/%s/%s.json', __DIR__, $lang, $item->id);

file_put_contents($file, json_encode($item, (JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)));

echo $file.PHP_EOL;
}
Expand Down
Loading

0 comments on commit 352ad48

Please sign in to comment.