-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlexica-url.php
38 lines (28 loc) · 999 Bytes
/
lexica-url.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
Namespace CurlBoilerplate;
class LexicaUrl {
const ORIGIN = 'https://lexica.art/api';
const API_VERSION = 'v1';
const LEXICA_ART_URL = self::ORIGIN . "/" . self::API_VERSION;
static function search_lexica($q) {
return self::LEXICA_ART_URL . "/search?q=$q";
}
static function send_request($url, $method) {
$setopt_content = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS,
CURLOPT_CUSTOMREQUEST => $method,
// CURLOPT_ENCODING => '',
// CURLOPT_MAXREDIRS => 10,
// CURLOPT_TIMEOUT => 0,
// CURLOPT_FOLLOWLOCATION => true,
//CURLOPT_POSTFIELDS => $post_fields,
//CURLOPT_HTTPHEADER => $this->headers,
);
$ch = curl_init();
curl_setopt_array($ch, $setopt_content);
$response = curl_exec($ch);
return $response;
}
}