Take the 2-minute tour ×

Hi I am trying to post data Using CURL in PHP to diigo bookmarking, I have tried through API, When i executing file i got HTTP basic authentication here is my code

$diggo = new DiigoAPI("username","password");
$book = $diggo->getBookmarks();

public function saveBookmarks($url)
    $attachment = array ("url" => $url, "title" => "SEnthil" , "shared" => "yes" );

    $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL,'https://secure.diigo.com/api/v2/bookmarks');
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //to suppress the curl output 
                $result = curl_exec($ch);
                echo $result;
                curl_close ($ch);
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Your curl doesn't have basic HTTP authentication set. You should set it up this way:

curl_setopt($curl, CURLOPT_USERPWD, $user_here . ":" . $password_here );

And the way you're doing it now the saveBookmarks function doesn't require the Diigo Class at all.

share|improve this answer

Your Answer


