fgtsai0418
-
Posts
26 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by fgtsai0418
-
-
-
case close
-
HiI want use imap_search to sort what I want , but it not working.can somebody help?<?set_time_limit(0);//Your gmail email address and password$username = 'name@gmail.com';$password = 'pwd';//Which folders or label do you want to access? - Example: INBOX, All Mail, Trash, labelname//Note: It is case sensitive$imapmainbox = "INBOX";//Select messagestatus as ALL or UNSEEN which is the unread email$messagestatus = "UNSEEN";//-------------------------------------------------------------------//Gmail Connection String$imapaddress = "{imap.gmail.com:993/imap/ssl}";//Gmail host with folder$hostname = $imapaddress . $imapmainbox;//Open the connection$connection = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());//Grab all the emails inside the inbox//$emails = imap_search($connection,$messagestatus);$emails = imap_search($connection,$messagestatus,'FROM, "c12.mobile.net"' );//number of emails in the inbox$totalemails = imap_num_msg($connection);echo "Total Emails: " . $totalemails . "<br>";if($emails) {//sort emails by newest firstrsort($emails);//loop through every email int he inboxforeach($emails as $email_number) {//grab the overview and message$header = imap_fetch_overview($connection,$email_number,0);//Because attachments can be problematic this logic will default to skipping the attachments$message = imap_fetchbody($connection,$email_number,1.1);if ($message == "") { // no attachments is the usual cause of this$message = imap_fetchbody($connection, $email_number, 1);}//split the header array into variables$status = ($header[0]->seen ? 'read' : 'unread');$subject = $header[0]->subject;$from = $header[0]->from;$date = $header[0]->date;echo "status: " . $status . "<br>";echo "from: " . $from . "<br>";echo "date: " . $date . "<br>";echo "message: " . $message . "<br><hr><br>";}}// close the connectionimap_close($connection);?>
-
This code can fetch Gmail all mail.But how to retrieve particular "domain name" like @123.xstartwar.com or particular "message" which title have "Mobile Position Report"<?set_time_limit(0);//Your gmail email address and password$username = 'name@gmail.com';$password = 'pwd';//Which folders or label do you want to access? - Example: INBOX, All Mail, Trash, labelname//Note: It is case sensitive$imapmainbox = "INBOX";//Select messagestatus as ALL or UNSEEN which is the unread email$messagestatus = "UNSEEN";//-------------------------------------------------------------------//Gmail Connection String$imapaddress = "{imap.gmail.com:993/imap/ssl}";//Gmail host with folder$hostname = $imapaddress . $imapmainbox;//Open the connection$connection = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());//Grab all the emails inside the inbox$emails = imap_search($connection,$messagestatus);//number of emails in the inbox$totalemails = imap_num_msg($connection);echo "Total Emails: " . $totalemails . "<br>";if($emails) {//sort emails by newest firstrsort($emails);//loop through every email int he inboxforeach($emails as $email_number) {//grab the overview and message$header = imap_fetch_overview($connection,$email_number,0);//Because attachments can be problematic this logic will default to skipping the attachments$message = imap_fetchbody($connection,$email_number,1.1);if ($message == "") { // no attachments is the usual cause of this$message = imap_fetchbody($connection, $email_number, 1);}//split the header array into variables$status = ($header[0]->seen ? 'read' : 'unread');$subject = $header[0]->subject;$from = $header[0]->from;$date = $header[0]->date;echo "status: " . $status . "<br>";echo "from: " . $from . "<br>";echo "date: " . $date . "<br>";echo "message: " . $message . "<br><hr><br>";//This is where you would want to start parsing your emails, send parts of the email into a database or trigger something fun to happen based on the emails.}}// close the connectionimap_close($connection);?>
-
case close
-
case close
-
I use imap function to open my GmailIt works, but information is wrong. Because my gmail have 108 mails.But it only show "0"===================================Date: Fri, 2 Aug 2013 10:09:52 +0800Driver: pop3Mailbox: {gmail-pop.l.google.com:995/pop3/notls/ssl/novalidate-cert/user="name@gmail.com"}INBOXMessages: 0Unread: 0Size: 0=================================<?php$authhost="{pop.gmail.com:995/pop3/ssl/novalidate-cert}";$user="name@gmail.com";$pass="pwd";$mbox=imap_open( $authhost, $user, $pass );{$check = imap_mailboxmsginfo($mbox);echo "Date: " . $check->Date . "<br />n" ;echo "Driver: " . $check->Driver . "<br />n" ;echo "Mailbox: " . $check->Mailbox . "<br />n" ;echo "Messages: " . $check->Nmsgs . "<br />n" ;echo "Unread: " . $check->Unread . "<br />n" ;echo "Size: " . $check->Size . "<br />n" ;imap_close($mbox);}?>
-
Hi Moderator
How can I fix it, if I have10 mails or 100 mails?
How to setup, only unread mail?
-
Thank You, Foxy.
New problem on line 26
Fatal error: Maximum execution time of 30 seconds exceeded in C:AppServwwwg.php
<?
$authhost="{pop.gmail.com:995/pop3/ssl/novalidate-cert}";$user="name@gmail.com";$pass="pwd";$mbox=imap_open( $authhost, $user, $pass );/* grab emails */$emails = imap_search($mbox , "ALL");/* if emails are returned, cycle through each... */if($emails) {/* begin output var */$output = '';/* put the newest emails on top */rsort($emails);/* for every email... */foreach($emails as $email_number) {/* get information specific to this email */$overview = imap_fetch_overview($mbox,$email_number,0);$message = imap_fetchbody($mbox,$email_number,2);/* output the email header information */$output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';$output.= '<span class="subject">'.$overview[0]->subject.'</span> ';$output.= '<span class="from">'.$overview[0]->from.'</span>';$output.= '<span class="date">on '.$overview[0]->date.'</span>';$output.= '</div>';/* output the email body */$output.= '<div class="body">'.$message.'</div>';}echo $output;}/* close the connection */imap_close($mbox);?> -
Parse error: syntax error, unexpected T_VARIABLE in C:AppServwwwg.php on line 21
-
somebody help check what's wrong is it?<?$authhost="{pop.gmail.com:995/pop3/ssl/novalidate-cert}";$user="name@gmail.com";$pass="pwd";$mbox=imap_open( $authhost, $user, $pass )/* grab emails */$emails = imap_search($mbox , "ALL");/* if emails are returned, cycle through each... */if($emails) {/* begin output var */$output = '';/* put the newest emails on top */rsort($emails);/* for every email... */foreach($emails as $email_number) {/* get information specific to this email */$overview = imap_fetch_overview($mbox,$email_number,0);$message = imap_fetchbody($mbox,$email_number,2);/* output the email header information */$output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';$output.= '<span class="subject">'.$overview[0]->subject.'</span> ';$output.= '<span class="from">'.$overview[0]->from.'</span>';$output.= '<span class="date">on '.$overview[0]->date.'</span>';$output.= '</div>';/* output the email body */$output.= '<div class="body">'.$message.'</div>';}echo $output;}/* close the connection */imap_close($mbox);?>
-
So...Use imap_check, imap_headerinfo, imap_body will get message body??
How to get all mail ? not only unread mail ?
-
Now I can do is it connect to Gmail but I don't know how to fetch a message only for "@123mobile.com" this domain name.*****************************<?php$authhost="{pop.gmail.com:995/pop3/ssl/novalidate-cert}";$user="username@gmail.com";$user="name@gmail.com";$pass="pwd";if ($mbox=imap_open( $authhost, $user, $pass )){echo "<h1>Connected</h1>n";$check = imap_mailboxmsginfo($mbox);echo "Date: " . $check->Date . "<br />n" ;echo "Driver: " . $check->Driver . "<br />n" ;echo "Unread: " . $check->Unread . "<br />n" ;echo "Size: " . $check->Size . "<br />n" ;imap_close($mbox);} else{echo "<h1>FAIL!</h1>n";}?>
-
case close
-
Can you help me check, why still not working....function load(User_Id) {var map = new google.maps.Map(document.getElementById("map_canvas"), {center: new google.maps.LatLng(22.601914,120.283186),zoom: 13,mapTypeId: google.maps.MapTypeId.ROADMAP});var infoWindow = new google.maps.InfoWindow;var geocoder = new google.maps.Geocoder();// Change this depending on the name of your PHP filedownloadUrl("db_2_xml.php?id="+User_Id, function(data) {var xml = data.responseXML;var markers = xml.documentElement.getElementsByTagName("markers");for (var i = 0; i < markers.length; i++) {var vessel = markers.getAttribute("vessel");var geocoder = new google.maps.Geocoder(geocoder.geocode(markers.getAttribute("GPS")));/*var pointss = new google.maps.LatLng(parseFloat(markers.getAttribute("lat")),parseFloat(markers.getAttribute("lng")));*/var speed = markers.getAttribute("speed");var icon = customIcons[type] || {};var marker = new google.maps.Marker({map: map,position: geocoder,icon: icon.icon,shadow: icon.shadow});bindInfoWindow(marker, map, infoWindow, html);}});
-
case close
-
when I use this code........
Why mysql will return double value???
SELECT A.* ,B.* ,C.* ,D.* FROM markers A LEFT OUTER JOIN vessel B ON B.VID=A.VID LEFT OUTER JOIN AUTH C ON C.VID = A.VID LEFT OUTER JOIN USER D ON D.UID = C.UID
-
I want to call "markers" table to php frontpage, but it should be include markers & vessel into one table.
-
I have one master table : M,salve : Auth、User、VM include M1~M7 cloumn , have one column include "Vid"Auth have two column uid、vidV have 4 column vid+V1~V3User have : uid、pwd
Now Dreamweaver can access into website link to user tableAnd now, I would like to shop M table (M1~M7 no "Vid") and V table (V1~V3 no "Vid")
what can I do now...SELECT * FROM ......
-
I was really too new to understand it
-
I am using PHP....
and you mean "It can be done in PHP as well, just change split() for explode()"
But I cannot find out split or explode code in here.
-
Hi
1. I don't have split() function..
2. I have change parsefloat and it still not working.
-
At this code...
center: new google.maps.LatLng(22.621177,120.298311),
google map needs "22.621177,120.298311" this format, but my system provide "22 37.271' N, 120 17.899' E" this format.
And I put all those data in mysql.
How can I made this data transform automatically?
-
This is my code, can you tell me more about geocode function
my mysql have two different column lat, lng
================================================<!DOCTYPE html ><head><meta name="viewport" content="initial-scale=1.0, user-scalable=no" /><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><title>PHP/MySQL & Google Maps Example</title><script type="text/javascript" src="http://maps.googleapis.com/maps/api/j ... "></script><script type="text/javascript">//<![CDATA[var customIcons = {school: {icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png',shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'},mrt: {icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'}};function load() {var map = new google.maps.Map(document.getElementById("map"), {center: new google.maps.LatLng(22.621177,120.298311),zoom: 13,mapTypeId: 'roadmap'});var infoWindow = new google.maps.InfoWindow;// Change this depending on the name of your PHP filedownloadUrl("phpsqlajax_genxml.php", function(data) {var xml = data.responseXML;var markers = xml.documentElement.getElementsByTagName("marker");for (var i = 0; i < markers.length; i++) {var name = markers.getAttribute("name");var pointss = new google.maps.LatLng(parseFloat(markers.getAttribute("lat")),parseFloat(markers.getAttribute("lng")));var icon = customIcons[type] || {};var marker = new google.maps.Marker({map: map,position: pointss,icon: icon.icon,shadow: icon.shadow});bindInfoWindow(marker, map, infoWindow, html);}});// Change this depending on the name of your PHP file // Draw a polyline downloadUrl("phpsqlajax_genxml.php", function(data) {var xml = data.responseXML;var markers = xml.documentElement.getElementsByTagName("marker");var path = [];for (var i = 0; i < markers.length; i++) {var lat = parseFloat(markers.getAttribute("lat"));var lng = parseFloat(markers.getAttribute("lng"));var point = new google.maps.LatLng(lat,lng);path.push(point);}//finish loopvar polyline = new google.maps.Polyline({path: path,strokeColor: "#FF0000",strokeOpacity: 1.0,strokeWeight: 2});polyline.setMap(map);}); //end download url}function bindInfoWindow(marker, map, infoWindow, html) {google.maps.event.addListener(marker, 'click', function() {infoWindow.setContent(html);infoWindow.open(map, marker);});}function downloadUrl(url, callback) {var request = window.ActiveXObject ?new ActiveXObject('Microsoft.XMLHTTP') :new XMLHttpRequest;request.onreadystatechange = function() {if (request.readyState == 4) {request.onreadystatechange = doNothing;callback(request, request.status);}};request.open('GET', url, true);request.send(null);}function doNothing() {}//]]></script></head><body onload="load()"><div id="map" style="width: 1000px; height: 500px"></div><p><?$link=mysqli_connect("localhost","name","pass") or die ("無法開啟Mysql資料庫連結"); //建立mysql資料庫連結mysqli_query($link, 'SET NAMES utf8'); mysqli_select_db($link, "markers"); //選擇資料庫markers$sql = "SELECT * FROM markers"; //在markers資料表中選擇所有欄位mysqli_query($link, "SET collation_connection = 'utf8_general_ci'");$result = mysqli_query($link,$sql); // 執行SQL查詢//$row = mysqli_fetch_assoc($result); //將陣列以欄位名索引//$row = mysqli_fetch_row($result); //將陣列以數字排列索引$total_fields=mysqli_num_fields($result); // 取得欄位數$total_records=mysqli_num_rows($result); // 取得記錄數?></p><table border='1'><tr><td>id</td></tr><? for ($i=0;$i<$total_records;$i++) {$row = mysqli_fetch_assoc($result); //將陣列以欄位名索引 ?><tr><td><? echo $row['id']; ?></td></tr><? } ?></table></body></html>
fetch particular "domain name" or particular "message"
in PHP
Posted
I have figure out this problem.