如何使用来自 PHP 中的视频主机 'MyStream.to' 的 cURL API
how to use cURL API, from a video host 'MyStream.to' in PHP
如何使用 cURL API,来自视频主机 'MyStream.to'
在 php!
API DOCUMENTATION FOR MyStream.to
1 This is the code that the documentation shows me :
curl "https://api.mystream.to/v1/files/:page" -H "Authorization: ACCESS_TOKEN" -D
2 I also tried (https://incarnate.github.io/curl-to-php/) it does not
work "for me" :
(of course I replaced ACCESS TOKEN with my personal API key.)
<?php
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mystream.to/v1/account-
information');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Authorization: ACCESS_TOKEN';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>
此 php 代码未显示任何内容
幸运的是,这里没有错误:)
然而,我看到的唯一 echo()
语句是否有错误。否则不输出!
尝试:
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $result;
}
如何使用 cURL API,来自视频主机 'MyStream.to'
在 php!
API DOCUMENTATION FOR MyStream.to
1 This is the code that the documentation shows me :
curl "https://api.mystream.to/v1/files/:page" -H "Authorization: ACCESS_TOKEN" -D
2 I also tried (https://incarnate.github.io/curl-to-php/) it does not work "for me" :
(of course I replaced ACCESS TOKEN with my personal API key.)
<?php
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mystream.to/v1/account-
information');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Authorization: ACCESS_TOKEN';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>
此 php 代码未显示任何内容
幸运的是,这里没有错误:)
然而,我看到的唯一 echo()
语句是否有错误。否则不输出!
尝试:
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $result;
}