sangnhoc88 Posted July 22, 2015 Share Posted July 22, 2015 (edited) Hi, I have picasa upload code, works fine at first, now the error $path = getcwd(). '/images/102183satan.jpg'; $albumUrl = "https://picasaweb.google.com/data/feed/api/user/$user/albumid/$/albumid"; // XML Upload được cung cấp bởi google $rawImgXml = '<entry xmlns="http://www.w3.org/2005/Atom"> <title>' . $path . '</title> <summary>' . $path . '</summary> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> </entry>'; // Lấy thông tin File $fileSize = filesize($path); $fh = fopen($path, 'rb'); $imgData = fread($fh, $fileSize); fclose($fh); // Data header, cấu trúc được cung cấp bởi google $dataLength = strlen($rawImgXml) + $fileSize; $data = ""; $data .= "\nMedia multipart posting\n"; $data .= "--P4CpLdIHZpYqNn7\n"; $data .= "Content-Type: application/atom+xml\n\n"; $data .= $rawImgXml . "\n"; $data .= "--P4CpLdIHZpYqNn7\n"; $data .= "Content-Type: image/jpeg\n\n"; $data .= $imgData . "\n"; $data .= "--P4CpLdIHZpYqNn7--"; $header = array( 'GData-Version: 2', 'Authorization: '.$access_token, 'Content-Type: multipart/related; boundary=P4CpLdIHZpYqNn7;', 'Content-Length: ' . strlen($data), 'MIME-version: 1.0' ); // Upload $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $albumUrl); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $ret = curl_exec($ch); curl_close($ch); echo $ret; Help me Edited July 22, 2015 by Ch0cu3r Added code tags Quote Link to comment https://forums.phpfreaks.com/topic/297418-errors-up-image-on-picasa/ Share on other sites More sharing options...
Ch0cu3r Posted July 22, 2015 Share Posted July 22, 2015 (edited) have picasa upload code, works fine at first, now the error What error is that? Post all error message(s) in full. It would also be helpful if you could explained what it is your are tying to do and what you are expecting the code to do? Also note when posting code place wrap it within tags or click the <> icon in the editor. Edited July 22, 2015 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/297418-errors-up-image-on-picasa/#findComment-1517054 Share on other sites More sharing options...
sangnhoc88 Posted July 23, 2015 Author Share Posted July 23, 2015 Errors are not up to the picasa Quote Link to comment https://forums.phpfreaks.com/topic/297418-errors-up-image-on-picasa/#findComment-1517149 Share on other sites More sharing options...
Ch0cu3r Posted July 23, 2015 Share Posted July 23, 2015 You are making no sense at all. If want use to help you fix the code we need to know what the problem is, preferably write your response in clear English sentences Quote Link to comment https://forums.phpfreaks.com/topic/297418-errors-up-image-on-picasa/#findComment-1517150 Share on other sites More sharing options...
sangnhoc88 Posted July 24, 2015 Author Share Posted July 24, 2015 the problem is we want up an image on picasa in php. Currently new picasa changed. What you write is to help you with Quote Link to comment https://forums.phpfreaks.com/topic/297418-errors-up-image-on-picasa/#findComment-1517256 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.