Jump to content

salman_ahad@yahoo.com

Members
  • Posts

    167
  • Joined

  • Last visited

    Never

Posts posted by salman_ahad@yahoo.com

  1.  

    PHP function that would return the next to last key (not value) in an array when an array is provided as a parameter.  If there are not two or more elements in the array, the function should return false.

     

    What will be the PHP script for this?

  2. Its not that I am not able to send emails. It sometimes goes and sometimes doesn't.

     

    I do not know anything about using smtp server for sending emails, not aware internal configuration. I am just writing a php script in my hosted server.

     

    Just need to know anything wrong with my present script????

     

     

  3.  

    I have echo in *for loop*, so as and when mails are sent it will show me a report $to_id and $to_email in table form.

     

    It is showing me all the emails I have in db...but my issue is that people are not receiving emails....

     

    Does anyone see any error ?

  4. I am trying to take email addresses from my database table and send email to everyone. But it shows that the email is sent but most of them complain the email never received...

     

    <?php 
    /*Sening emails to users using script*/
    
    /*Selecting all the users from database*/
    require('includes/connection.php');
    $userArray = array();
    $i = 0;
    $result = mysql_query("SELECT DISTINCT email_id, email_address FROM submit_emails")or die(mysql_error());
    if(!empty($result))
    {
    while($row = mysql_fetch_array($result))
    	{
    	$userArray['id'][$i] = $row['email_id'];
    	$userArray['email'][$i] = $row['email_address'];
    	$i++;
    	$counter = $i;
    	}
    }
    
    /*Actual html mail*/		
    for($j=0; $j <= $counter; $j++)
    {
    $to_email = $userArray['email'][$j];
    $to_id = $userArray['id'][$j];
    $subject = 'Learn New Technologies';
    $message = ''   // This is the message...dont worry abt this!
    .'<table width="520" border="0">'
    .	'<tr>'
    .		'<td width="514"><img src="http://www.ideatoceo.com/emails/kalima.gif" width="514" height="89" longdesc="http://shetech.ideatoceo.com/registration.php"/></td>'
    .	'</tr>'
    .	'<tr>'
    .		'<td>'
    	.'<table width="512" border="0">'
    	.	'<tr>'
    	.		'<td width="251"> '
    	.'<div align="center"><span style="color:#333333" style="font-size:8px">Group of professionals are now ready to train muslims for FREE</span></div>'
    	.          	'<p>   <span style="color:#000033" style="font-weight:bold">PHP</span><br />   <span style="color:#003300" style="font-weight:bold">MySQL</span><br />   <span style="color:#993300" style="font-weight:bold">Web Services</span><span style="color:#000000" style="font-weight:bold"> & more...</span></p>'
    	.			'<p align="center" style="color:#990000" style="font-weight:bold"><a href="http://shetech.ideatoceo.com/registration.php" target="_blank">Work on live projects and get trained!</a></p>'
    	.		'</td>'
    	.		'<td width="251"><img src="http://www.ideatoceo.com/emails/training.gif" width="205" height="204" align="right" longdesc="http://shetech.ideatoceo.com/registration.php"/></td>'
        .	'</tr>'
    	.'</table>'
    .		'</td>'
    .	'</tr>'
    .	'<tr>'
    .		'<td><label><label><img src="http://www.ideatoceo.com/emails/Bottom2.gif" width="514" height="48" longdesc="http://shetech.ideatoceo.com/registration.php"/></label></label></td>'
    .	'</tr>'
    .'</table>'
    .'<table>'
      	.'Forward to friends and help them, visit <a href="http://www.ideatoceo.com/islam/emails.php" target="_blank">IdeatoCEO </a><br />'
    .'<a href="http://www.ideatoceo.com/islam/remails.php" target="_blank">Unsubscribe</a> from the distribution<br />'
    .	'<br />'
    .'www.ideatoceo.com | XXXXX | Saint Louis | MO | XXXX <br  />'
    .'</table>';
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= "X-Priority: 1 (Higuest)\n"; 
    $headers .= "X-MSMail-Priority: High\n"; 
    $headers .= "Importance: High\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From:info@ideatoceo.com' . "\r\n";	
    echo "<table border='1'>
    <tr>
    <th>Email Sent to following people</th>
    </tr>";
    echo "<tr>";
    echo "<td>" . $to_id . "</td>" . "<td>" . $to_email . "</td>";
    echo "</tr>";
    
    mail($to_email, $subject, $message, $headers);
    
    echo "</table>";
    sleep(1);
    
    } 
    ?>
    

  5. I removed public but there is no output.

     

    <?php
    $longurl = "http://advertise.ideatoceo.com";
    function get_bitly_shorturl($longurl) {  //getting parse error here
            $url = "http://api.bit.ly/shorten?" . 
                "version=2.0.1&login=XXXX&apiKey=XXXX" . 
                "&format=json&history=1" . 
                "&longUrl=".urlencode($longurl); 
            $page = file_get_contents($url); 
            $result = json_decode($page); 
            return $result->{'results'}->{$longurl}->{'shortUrl'}; 
        } 
    ?>
    

     

  6. I am getting "parse" error while using this code

     

    <?php
    $longurl = "http://advertise.ideatoceo.com";
    public function get_bitly_shorturl($longurl) {  //getting parse error here
            $url = "http://api.bit.ly/shorten?" . 
                "version=2.0.1&login=XXXX&apiKey=XXXX" . 
                "&format=json&history=1" . 
                "&longUrl=".urlencode($longurl); 
            $page = file_get_contents($url); 
            $result = json_decode($page); 
            return $result->{'results'}->{$longurl}->{'shortUrl'}; 
        } 
    ?>
    

  7.  

    I am trying to shorten my link using bit.ly API. If someone has idea of using curl and using this API, please let me know

     

    $host = "http://api.bit.ly/shorten?version=2.0.1&longUrl=http://www.ideatoceo.com";
    var_dump($host);
    

     

    I am not properly calling the API or not using curl...please help

  8.  

    At this link

    http://tweetmeme.com/i/scripts/button.js

     

    the code present is

    (function(){var _url=window.location.href;
    var _url=_url.replace(/((?:\?|&)?fbc_receiver=.+)?(?:#.*)?$/,"");
    var url=escape((typeof tweetmeme_url=="string")?tweetmeme_url:((typeof TWEETMEME_URL=="string")?TWEETMEME_URL:_url)).replace(/\+/g,"%2b");
    var source=(typeof tweetmeme_source=="string")?escape(tweetmeme_source)(typeof TWEETMEME_SOURCE=="string")?escape(TWEETMEME_SOURCE):false);var style=(typeof tweetmeme_style=="string")?escape(tweetmeme_style)(typeof TWEETMEME_STYLE=="string")?escape(TWEETMEME_STYLE):"normal");
    var service=(typeof tweetmeme_service=="string")?escape(tweetmeme_service)(typeof TWEETMEME_SERVICE=="string")?escape(TWEETMEME_SERVICE):false);
    var service_api=(typeof tweetmeme_service_api=="string")?escape(tweetmeme_service_api)(typeof TWEETMEME_SERVICE_API=="string")?escape(TWEETMEME_SERVICE_API):false);
    var alias=(typeof tweetmeme_alias=="string")?escape(tweetmeme_alias)(typeof TWEETMEME_ALIAS=="string")?escape(TWEETMEME_ALIAS):false);
    var src="http://api.tweetmeme.com/button.js";
    switch(style){case"compact":var h=20;var w=90;break;case"rednose":var h=61;var w=50;break;default:var h=61;var w=50;break}src+="?url="+url;src+="&style="+style;if(source!=false){src+="&source="+source}if(service){src+="&service="+service}if(service_api){src+="&service_api="+service_api}if(alias){src+="&alias="+alias}document.write('<iframe src="'+src+'" height="'+h+'" width="'+w+'" frameborder="0" scrolling="no"></iframe>');
    tweetmeme_url=null;TWEETMEME_URL=null;
    tweetmeme_source=null;
    TWEETMEME_SOURCE=null;
    tweetmeme_service=null;
    TWEETMEME_SERVICE=null;
    tweetmeme_service_api=null;
    TWEETMEME_SERVICE_API=null;
    tweetmeme_style=null;
    TWEETMEME_STYLE=null})();
    

     

    Now when you call this function using a script

    <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

     

    It inserts a button(app 100X100 px) on your webpage...

     

    Now instead on tweetmeme people should be able to call

    http://MYSITE.com/i/scripts/button.js

  9.  

    tweetmeme website has a button called "retweet" which could be inserted on any webpage of any site. You just need to insert this script on your page.

     

    <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

     

    When this button is clicked from your website it connects with twitter, takes your twitter credentials, takes the title and link to your webpage and inserts in that twitter account.

    Inserting could be done with another xml api which I have.

     

    I just need help from PHPfreak Guru's and others to develop the same button script on my website. Then lets say phpfreaks.com can call my site using this script and my site allows it to insert tweet and give a count.(same like tweetmeme)

     

     

  10.  

    I am trying to retrieve information from this JSON API, getting this error

     

    Catchable fatal error: Object of class stdClass could not be converted to string
    

     

    My code

     

    $json   = file_get_contents('http://api.tweetmeme.com/url_info.json?url=http://is.gd/lznv');
       $data   = json_decode($json);
       echo $data;
    

  11.  

    so I am sending the mail in html form, what am I missing...whats wrong?

     

    <?php 
    require('includes/connection.php');
    $to_email = 'mohammed.ahad@gmail.com';
    $subject = 'How to forward Islamic emails';
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <style type="text/css">
    .style1 {color: #990000}
    .style2 {
    color: #000033;
    font-weight: bold;
    }
    .style3 {
    color: #003300;
    font-weight: bold;
    }
    .style4 {
    color: #993300;
    font-weight: bold;
    }
    .style5 {color: #000000}
    .style6 {color: #000000; font-weight: bold; }
    .style7 {color: #333333}
    </style>
    </head>
    
    <body>
    <?php
    $message = ''
    .'<table width="520" border="0">'
    .	'<tr>'
    .		'<td width="514"><img src="http://www.ideatoceo.com/emails/kalima.gif" width="514" height="89" longdesc="http://shetech.ideatoceo.com" /></td>'
    .	'</tr>'
    .	'<tr>'
    .		'<td>'
    	.'<table width="512" border="0">'
    	.	'<tr>'
    	.		'<td width="251" al>  <div align="center"><span class="style7">Group of professionals are now ready to train muslims FREE</span></div>'
    	.		'<p>   <span class="style2">PHP</span>		<br />   <span class="style3">MySQL</span><br />   <span class="style4">Web Services <span class="style5">& more</span></span><span class="style6">...</span></p>'
    	.		'<p align="center" class="style1">Work on live projects and get trained!'
    	.		'</td>'
    	.		'<td width="251"><img src="http://www.ideatoceo.com/emails/training.gif" width="205" height="204" align="right" longdesc="http://shetech.ideatoceo.com" /></td>'
        .	'</tr>'
    	.'</table>'
    .		'</td>'
    .	'</tr>'
    .	'<tr>'
    .		'<td><label><label><img src="http://www.ideatoceo.com/emails/Bottom2.gif" width="514" height="48" longdesc="http://shetech.ideatoceo.com" /></label></label></td>'
    .	'</tr>'
    .'</table>'
    .'<table>'
      	.'Forwarding Hadith to friends is now easy, visit <a href="http://www.ideatoceo.com/islam-emails.php" target="_blank">IdeatoCEO </a><br />'
    .'<a href="http://www.ideatoceo.com/islam/emails.php" target="_blank">Unsubscribe</a> from the distribution<br />'
    .	'<br />'
    .'www.ideatoceo.com | 192 allen ave | Saint Louis | MO | 63104 <br  />'
    .'</table>';
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= "X-Priority: 1 (Higuest)\n"; 
    $headers .= "X-MSMail-Priority: High\n"; 
    $headers .= "Importance: High\n"; 
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: islam@ideatoceo.com' . "\r\n";	
    mail($to_email, $subject, $message, $headers);	
    ?>
    </body>
    </html>
    
    

  12.  

    I am trying to send email using mail() function.

     

    I want to be able to include the css style in message too. My present code is

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <style>
    .style1 {
    color: #777777;
    }
    .style2 {
    color: #666666;
    }
    </style>
    </head>
    </html>
    
    
    <?php
    $to = "xyz@mysite.com";
    $subject = "promotion";
    $message = ''
    .	'<table width="520" border="0" bordercolor="#FFFFFF">'
    .	'  <tr>'
    .	'    <td width="514" height="90"><p> </p>'
    .	'    <p><span class="style1">Reach out to Community!! </span></p>'
    .	'        <span class="style2">1. Click the mail below.</span><br /><br /> </td>'
    .	'  </tr>'
    .	'</table>';
    mail($to, $subject, $message);
    ?>
    

     

     

  13.  

    In my hosting provider service(godaddy) I have edited my spf value

     

    v=spf1 a mx ptr ip4: xx.xx.xxx.xxx  mx:mailstore.server.net mx:smtp.server.net +all
    

     

    My SRV or AAAA records under DNS are still empty. Do I need to edit that too?

     

  14.  

    Will making my emails as High priority avoid them from going in 'spam'

     

    ..
    ..
    ..
            $headers = "MIME-Version: 1.0\n" ; 
            $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
            $headers .= "X-Priority: 1 (Higuest)\n"; 
            $headers .= "X-MSMail-Priority: High\n"; 
            $headers .= "Importance: High\n"; 
    
    $status   = mail($to, $subject, $message,$headers); 
    
    

     

    my emails are still going in spam, help me

     

  15.  

    Ok i got this from other site

     

    the recipient’s spam filter checks if all headers exist in sender’s email and since you are using simple mail() function it will be almost with empty header so that means high risk of spam  to solve that problem you need to use some more complicated mailer class
    
    and the best solution is to use gmail account as SMTP relay
    

     

    How can I optimize my header more

  16.  

    I am using a header like this, but still no help ??

     

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: name@mysite.com' . "\r\n";
    mail($to_email, $subject, $message, $headers);
    

     

    Any more ideas?

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.