Update activitypub.extend.php
This commit is contained in:
parent
ec972bc5a1
commit
59a1248bf6
|
@ -330,13 +330,22 @@ function activitypub_build_http_headers($headers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function activitypub_http_get($url, $access_token = '') {
|
function activitypub_http_get($url, $access_token = '') {
|
||||||
// write a HTTP header
|
// make the time string
|
||||||
$headers = array("Accept" => "application/ld+json; profile=\"" . NAMESPACE_ACTIVITYSTREAMS . "\"");
|
$tz = new DateTimeZone('GMT');
|
||||||
|
$dt = new DateTime('now', $tz);
|
||||||
|
$now = $dt->format('d M Y H:i:s e'); // e.g. 18 Dec 2019 10:08:46 GMT
|
||||||
|
|
||||||
|
// build the header
|
||||||
|
$headers = array(
|
||||||
|
"Date" => $now,
|
||||||
|
"Accept" => "application/ld+json; profile=\"" . NAMESPACE_ACTIVITYSTREAMS . "\""
|
||||||
|
);
|
||||||
if (!empty($access_token)) {
|
if (!empty($access_token)) {
|
||||||
$headers["Authorization"] = "Bearer " . $access_token;
|
$headers["Authorization"] = "Bearer " . $access_token;
|
||||||
}
|
}
|
||||||
|
// Todo: Add Signature header
|
||||||
|
|
||||||
// do HTTP request
|
// request
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt_array($ch, array(
|
curl_setopt_array($ch, array(
|
||||||
CURLOPT_URL => $url,
|
CURLOPT_URL => $url,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user