GitHub创建显示无效电子邮件地址的gist api调用

时间:2017-10-30 07:22:17

标签: php html github

我正在使用github gist API来创建使用php的新gists,gists正在创建但未在列表中显示。

将“invalid-email-address”作为输出。

下面是代码

$headers = array(
        'User-Agent: PHP',
        'X-OAuth-Scopes: repo, user, gist',
        'X-Accepted-OAuth-Scopes: repo, user, gist'
    );

    $data_string = json_encode($data);
    # Sending the data using cURL
    $url = 'https://api.github.com/gists';
    $ch = curl_init($url);
    curl_setopt($your_resource, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_USERAGENT,$user);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);

    curl_close($ch);

getting below output

0 个答案:

没有答案