RSS

Monthly Archives: October 2009

send xml over post

<?php

/*

$url = Web Service Url or Server Url where xml have to post

$xml = XML  schema to post on server

*/

function sendXmlOverPost($url, $xml)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);

// For xml, change the content-type.
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array(“Content-Type: text/xml”));

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // ask for results to be returned
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

// Send to remote and return data to caller.
$result = curl_exec($ch);
curl_close($ch);
return $result;

}

?>

Advertisements
 
Leave a comment

Posted by on October 25, 2009 in Fedora, LAMP, php, Tips, Web Services

 

Tags: , , , ,

Oscommerce – made easy

osCommerce is an online e-commerce solution that offers a wide range of features that allows online stores to be setup quickly with ease, and is available for free as an Open Source based solution released under the GNU General Public License.

http://svn.oscommerce.com/confluence/display/OSCDOC/Installation+and+Upgrades

http://www.oscommerce.info/contents

 
Leave a comment

Posted by on October 24, 2009 in LAMP, oscommerce, php, Tips, Tricks

 

Tags: , ,

pdftohtml

<?php

echo exec(“/usr/bin/pdftohtml -c -noframes ‘/var/www/html/htmldoc/pdf/svnlabs.pdf’ > ‘/var/www/html/htmldoc/pdf/svnlabs.html’ 2>&1″);

?>

 
Leave a comment

Posted by on October 22, 2009 in Fedora, LAMP, Linux, php, Tips, Tricks, Web Services

 

Tags: , ,

Soap Client for MMS

Web services are widely supported the major technologies..
There are some ways to make web services: XML-RPC, SOAP and REST

here is the demo in nuSOAP for sending MMS to mobiles using MM7 protocol….

<?
// Pull in the NuSOAP code
require_once(‘nusoap.php’);
require_once(‘nusoapmime.php’);

$wsurl = WEBSERVICEURL;
$operation = “SubmitReq”;
$username = USERNAME;
$password = PASSWORD;
$vaspid = VASPID;
$vasid = VASID;
$shortcode = ShortCode;
$mobileno = NUMBER;  // with country code
$msg = MESSAGE;

$mms = “svnlabs.gif”;

$TransactionID = time();

$namespace[]= “http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4&#8221;;
$ns= “http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-6-MM7-1-4&#8221;;
$mm7version = “6.8.0”;

$proxyhost = isset($_POST[‘proxyhost’]) ? $_POST[‘proxyhost’] : ”;
$proxyport = isset($_POST[‘proxyport’]) ? $_POST[‘proxyport’] : ”;
$proxyusername = isset($_POST[‘proxyusername’]) ? $_POST[‘proxyusername’] : ”;
$proxypassword = isset($_POST[‘proxypassword’]) ? $_POST[‘proxypassword’] : ”;
$useCURL = isset($_POST[‘usecurl’]) ? $_POST[‘usecurl’] : ‘0’;

$client = new nusoap_client_mime($wsurl, false,
$proxyhost, $proxyport, $proxyusername, $proxypassword);

// Check for an error
$err = $client->getError();
if ($err) {
// Display the error
echo ‘<p><b>Constructor error: ‘ . $err . ‘</b></p>’;
// At this point, you know the call that follows will fail
}

$client->setCredentials($username, $password);

$client->soap_defencoding = ‘UTF-8’;

$soapaction = “”;

$client->usedNamespaces=$namespace;

$headers = ‘<mm7:TransactionID xmlns:mm7=”‘.$ns.'” mm7:mustUnderstand=”1″>’.$TransactionID.'</mm7:TransactionID>’;

$client->setHeaders($headers);

$params = array(‘MM7Version’=>$mm7version,
‘SenderIdentification’=>array(
‘VASPID’=>$vaspid,’VASID’ =>$vasid,
‘SenderAddress’=>array(‘ShortCode’=>$shortcode)),
‘Recipients’=> array(‘To’=>array(‘Number’=>$mobileno)),
‘DeliveryReport’=>’true’,
‘Subject’=>$msg,
‘Content’=>’mycontentgeneric’);

$client->setUseCurl($useCURL);
$client->setHTTPEncoding(‘deflate, gzip’);
$cid = $client->addAttachment(”, $mms, “image/gif”, “svnMMS”);

$result = $client->call($operation, $params, $ns, $soapaction,$headers);

if ($client->fault) {
echo ‘<h2>Fault</h2><pre>’; print_r($result); echo ‘</pre>’;
} else {
$err = $client->getError();
if ($err) {
echo ‘<h2>Error</h2><pre>’ . $err . ‘</pre>’;
} else {
echo ‘<h2>Result</h2><pre>’; print_r($result); echo ‘</pre>’;
echo ‘<h2>Attachments</h2><pre>’;
$attachments = $client->getAttachments();
foreach ($attachments as $att) {
echo ‘Filename: ‘ . $att[‘filename’] . “\r\n”;
echo ‘Content-Type: ‘ . $att[‘contenttype’] . “\r\n”;
echo ‘cid: ‘ . htmlspecialchars($att[‘cid’], ENT_QUOTES) . “\r\n”;
echo htmlspecialchars($att[‘data’], ENT_QUOTES);
echo “\r\n”;
}
echo ‘</pre>’;
}
}

echo ‘<h2>Request</h2><pre>’ . htmlspecialchars($client->request, ENT_QUOTES) . ‘</pre>’;
echo ‘<h2>Response</h2><pre>’ . htmlspecialchars($client->response, ENT_QUOTES) . ‘</pre>’;

?>

 
2 Comments

Posted by on October 20, 2009 in LAMP, Mobiles, php, Tips, Web Services

 

Tags: , , , , ,

Happy Diwali

दीपावली क़े शुभ अवसर पर आप क़ो बहुत-बहुत शुभकामनाएँ………….”शुभ दीपावली”

Happy Diwali

Happy Diwali

 
Leave a comment

Posted by on October 16, 2009 in Uncategorized

 

Tags: , , , ,

Grep / ACK

Grep / ACK

Ack can be replacement for grep…..

# yum install ack

Suppose you are on /var/www/html, here you want to search text “svnlabs” in all files in current directory…. you can use:

# ack svnlabs
# man ack    (for more options)

grep : print lines matching a pattern.

find : search for files in a directory.

# grep -iR 'svnlabs' *.txt 
(It will search svnlabs in all text files in current directory)

Sources:
http://www.cyberciti.biz/faq/unix-linux-finding-files-by-content/
http://www.doyourself.org/index.php?page=5&ipp=10&category=linux
http://blog.amit-agarwal.co.in/2009/08/28/ack-on-solaris-grep-recursively/

 
10 Comments

Posted by on October 15, 2009 in Fedora, LAMP, Linux, Tips, Tricks

 

Tags: , , , ,

midentify – mplayer

midentify – It is the utility come with mplayer to find video ID of video files….

# /usr/bin/midentify video.mp4
ID_VIDEO_ID=0
ID_AUDIO_ID=1
ID_AID_1_LANG=eng
ID_FILENAME=video.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=avc1
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=320
ID_VIDEO_HEIGHT=240
ID_VIDEO_FPS=25.000
ID_VIDEO_ASPECT=1.3333
ID_AUDIO_FORMAT=255
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=24000
ID_AUDIO_NCH=2
ID_LENGTH=72.62
ID_SEEKABLE=1
ID_CHAPTERS=0
ID_VIDEO_CODEC=ffh264
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_AUDIO_CODEC=faad
ID_EXIT=EOF

Try # mediainfo to get video infrmation on linux box  🙂

 
Leave a comment

Posted by on October 15, 2009 in Fedora, LAMP, Linux, Tips, Tricks, Web Application

 

Tags: , ,