Posted by: Anil Kumar Panigrahi in: ● July 2, 2010
Hi friends,
In this post i want to explain how to create rss feeds using php code and get the data from mysql table.
1) Connect to database:
We already discussed about how to connect database using php code.See the following code to connect database:
1
2
3
4
5
6
7
8
9
10
11
<?php
DEFINE (’DB_USER’, ‘root’);
DEFINE (’DB_PASSWORD’, ‘root’);
DEFINE (’DB_HOST’, ‘localhost’);
DEFINE (’DB_NAME’, ‘rss’);
// Make the connnection and then [...]
Posted by: Anil Kumar Panigrahi in: ● June 27, 2010
The following script to copy the text from remote url using php code.
<?php
$regex = ‘/]*>(.*<\/body>/smi’;
/*END config, BEGIN html*/
$data = file_get_contents($siteName) or die(’Cannot read ‘ . $siteName);
preg_match($regex, $data, $cleanData);
if(!empty($cleanData))
$data = $cleanData[1];
echo $data;
?>
<!– HTML Footer Data here… –>
This is simple copy text from another site, but it will be useful for who are new to php.
Posted by: Anil Kumar Panigrahi in: ● March 18, 2010
Hi friends,
In our php application some times we want to highlight the source code to user friendly , so the following function helped you to highlight the source code.
<?php
if (!empty($_POST[’text’])){
echo ‘<div style="border: solid 1px red; width:300px;height: 150px; padding: 20px; margin: 20px">’;
highlight_string(stripslashes($_POST[’text’]));
echo ‘</div>’;
}
?>
<form action="<?php echo $_SERVER[’PHP_SELF’]?>" method="post">
<textarea name="text" style="width: 300px; height: 150px;padding: 20px; margin: 20px"><?php echo [...]
Posted by: Anil Kumar Panigrahi in: ● September 16, 2009
Hi,
The following code will work, this functionality is use the external html content as email body.
$mail = new PHPMailer();
$mail->IsMail();
$mail->Timeout = 360;
$mail->From = "";
$mail->FromName = "";
$mail->AddReplyTo(“”);
$mail->AddAddress($Email);
$mail->IsHTML(true);
$mail->Subject = "Html as email";
$file = fopen("email.html","r");
$str=fread($file,filesize("email.html"));
$str = trim($str);
fclose($file);
$mail->Body = $str;
$mail->Send();
Then it will send the external html file as email body.
But be sure that in the html [...]
Comments