YouTube 동영상에 댓글을 게시하려고합니다 ...이를 위해 YouTube API를 사용합니다. 여기에 코드입니다 : 그 개인 물건을 숨기기 위해 참조CURL 요청이 작동하지 않는 이유는 무엇입니까?
<?php
$message="Just Some Comment...";
$developer_key="<!---visit demo for actual code---!>";
$access_token=$_GET['code'];
if(!$access_token){ Header("Location: <!---visit demo for actual code---!>");}
$video_id="I3LMKhu2-vo";
$message_xml='<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:yt="http://gdata.youtube.com/schemas/2007">
<content>' . $message . '</content>
</entry>';
$url = "http://gdata.youtube.com/feeds/api/videos/" . $video_id . "/comments";
$header = array('Content-Type: application/atom+xml', 'Content-Length: ' . strlen($message_xml), 'Authorization: Bearer "' . $access_token . '"', 'GData-Version: 2', 'X-GData-Key: key=' . $developer_key);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$message_xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo curl_error($ch);
curl_close($ch);
echo $access_token;
?>
,하지만 당신은 그래서 제 질문은, 왜 댓글이 비디오에 나타나지 않음 votm.net78.net 에서 데모를 볼 수 있습니다, 사용자가 승인 토큰을 보냈지 만? 이 문제에 대해 도움을받을 수 있습니까? 감사!
''$ result'에 무엇이 있습니까? '$ result = curl_exec ($ ch);'뒤에'var_dump ($ result);를 넣으면 어떻게 될까요? –