|
 |
|
อับโหลดรูปเข้า facebook ไม่ได้ครับ [php , facebook api] |
|
 |
|
|
 |
 |
|
ตอนนี้ผมทำให้มัน สร้างอัลบั้มได้แล้ว แต่ไม่สามารถอัพรูปเข้าไปได้
ตามรูปครั้บ

และตอนเข้าเพจที่ทำการสร้างอัลบั้มและอัพรูปมันขึ้นว่า
Code (PHP)
Fatal error: Uncaught CurlException: 3: No URL set! thrown in /home/vhosts/www.xxx.com/app/facebook-php-sdk/src/base_facebook.php on line 774
โค้ดครับ
Code (PHP)
<?php
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
'cookie' => true,
));
$user = $facebook->getUser();
if ($user) {
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message' => 'album_description',
'name' => 'album_name'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$photo_details = array(
'message'=> 'Photo message'
);
//$file = $_SERVER['DOCUMENT_ROOT'] . "/app/pic/" . rand(1,5) . ".jpg";
$file = $_SERVER['DOCUMENT_ROOT'] . "/app/pic/1.jpg";
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
}
?>
ปล. app permission ผมเขียนแล้วนะครับ
Tag : PHP, CakePHP

|
ประวัติการแก้ไข 2012-03-26 00:47:15
|
 |
 |
 |
 |
Date :
2012-03-26 00:43:05 |
By :
sornram9254 |
View :
1683 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
1.เปิดใช้งาน Curl หรือยังครับ
2.ถ้าเปิดแล้ว ในกรณีนี้น่าจะเกิดจาก ฟังชั่นใน facebook.php ทำงานทับกันหรือชนกันอยู่ หรือ เรียกใช้ไม่ถูกจนมันชนกัน ตรวจสอบดูดีๆครับ
|
 |
 |
 |
 |
Date :
2012-03-26 12:23:13 |
By :
lootboom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|