Skip to content

Commit

Permalink
Version 0.3
Browse files Browse the repository at this point in the history
- Fixed problems in cURL POST which would cause some images not
  being submitted to the cache server.

Signed-off-by: Weihao Jiang <weihau.chiang@gmail.com>
  • Loading branch information
Victrid committed Aug 11, 2022
1 parent 1e7e5c5 commit 66baaf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,20 @@ public function handleConfigureAction() {
}

public static function posturl($url,$data){
$data = json_encode($data);
$headerArray =array("Content-type:application/json;charset='utf-8'","Accept:application/json");
$data = json_encode($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headerArray);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json;charset='utf-8'",
'Content-Length: ' . strlen($data),
"Accept: application/json")
);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$output = curl_exec($curl);
curl_close($curl);
return json_decode($output, true);
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Image Cache",
"author": "Victrid",
"description": "Cache feed images on your own facility or Cloudflare cache.",
"version": 0.2,
"version": 0.3,
"entrypoint": "ImageCache",
"type": "user"
}

0 comments on commit 66baaf9

Please # to comment.