脚本宝典收集整理的这篇文章主要介绍了php – 通过电子邮件发送照片到我的Facebook页面,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经测试了电子邮件地址……工作正常,我可以提交图像,但我的PHP脚本不显示照片.它将主题发布到Facebook,但就是这样.
首先,这是将图像@L_304_9@到我的粉丝页面的最佳方式吗?
其次,我是否使用正确格式的电子邮件,以便在Multipart Mime TyPE中工作?
这是我目前在cron上运行的脚本
// array wITh filenames to be sent as attachment $files = array("public_htML/langcam/09.jpg","public_html/langcam/13.jpg","public_html/langcam/16.jpg","public_html/caswellcam/09.jpg","public_html/caswellcam/13.jpg","public_html/caswellcam/16.jpg","public_html/llangcam/09.jpg","public_html/llangcam/13.jpg","public_html/llangcam/16.jpg"); // email fields: to,From,subject,and so on $to = "uniqueaddress@m.facebook.com"; $from = "email@mysite.com"; $subject = "On ".date("F j,Y")." the wavebuoy at 1pm was ". $waveheightb."ft @ ".$seconds."seconds with a ".$windcompass." wind at ".$windspeedb."mph"; $message = "I normally leave this blank"; $headers = "From: $from"; // boundary $SEMi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // headers for attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // multipart boundary $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-@R_419_302@: 7bit\n\n" . $message . "\n\n"; $message .= "--{$mime_boundary}\n"; // PReparing attachments for($x=0;$x<count($files);$x++){ $file = fopen($files[$x],"rb"); $data = fread($file,filesize($files[$x])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$files[$x]\"\n" . "Content-@R_419_302@: base64\n\n" . $data . "\n\n"; $message .= "--{$mime_boundary}\n"; } // send $ok = @mail($to,$subject,$message,$headers); if ($ok) { echo "Mail sent to $to!"; } else { echo "Mail Could not be sent!"; }
谢谢
背风处
您可能想要查看Facebook Graph API.我不确定它是否适用于粉丝页面,但是没有理由不这样做.忽略博客文章标题,然后向下滚动到文章的第二部分,了解如何创建相册并将照片上传到相册.
https://developers.facebook.com/blog/post/498/
用于照片的Facebook Graph API页面位于以下URL:
http://developers.facebook.com/docs/reference/api/photo/
或者在http://ifttt.com上创建一个ifttt脚本,因为它可能更容易.
乔恩
以上是脚本宝典为你收集整理的php – 通过电子邮件发送照片到我的Facebook页面全部内容,希望文章能够帮你解决php – 通过电子邮件发送照片到我的Facebook页面所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。