CURL, a simple way to send HTTP Requests

Definition: CURL


curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.


Ref: http://curl.haxx.se/


Using CURL in XAMPP


There appear to be a lot of misguided people on the intarwebs claiming all sorts of varying things you have to do to get CURL to work on a Windows-based XAMPP install. I’d like to clear them all up here and now.


It’s really quite simple - uncomment extension=php_curl.dll in your php.ini file available in the Apache\bin directory, then restart Apache


Ref: http://incoherentbabble.com/2007/04/21/using-curl-in-xampp/


Example



//initialize the request variable
$request = "";

//this is the username of our TM4B account
$param["username"] = "abcdef";

//this is the password of our TM4B account
$param["password"] = "12345";

//this is the message that we want to send
$param["msg"] = "This is sample message.";

//these are the recipients of the message
$param["to"] = "447768254545|447956219273|447771514662";

//this is our sender
$param["from"] = "MyCompany";

//we want to send the message via first class
$param["route"] = "frst";

//we are only simulating a broadcast
$param["sim"] = "yes";

//traverse through each member of the param array
foreach($param as $key=>$val){
//we have to urlencode the values
$request.= $key."=".urlencode($val);
//append the ampersand (&)
//sign after each paramter/value pair
$request.= "&";
}
//remove the final ampersand sign from the request
$request = substr($request, 0, strlen($request)-1);

//this is the url of the gateway's interface
$url = "http://www.tm4b.com/client/api/send.php";

//initialize curl handle
$ch = curl_init($url);

//set the url
curl_setopt($ch, CURLOPT_URL, $url);

//return as a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

//set POST method
curl_setopt($ch, CURLOPT_POST, 1);

//set the POST variables
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

//run the whole process and return the response
$response = curl_exec($ch);

curl_close($ch); //close the curl handle
//show the result onscreen for debugging
//print $response;

Ref: http://www.sephiroth.it/tutorials/flashPHP/sms/

(in the above code from this link modified for error free result. The bolded parameter in the code was missed unexpectedly).

Form Styling - CSS

Ever wanted to match the look of your HTML forms with the rest of your website? This article demonstrates how to apply customized backgrounds to HTML forms, while preserving structurally clean markup and accessibility.


Checkout this URL:
http://www.picment.com/articles/css/funwithforms/


Setup Apache, PHP and MySQL

Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.

At the moment there are four XAMPP versions:
  • a version for Linux systems (tested for Ubuntu, SuSE, RedHat, Mandrake and Debian),
  • a version for Windows 98, NT, 2000, 2003, XP and Vista,
  • a beta version for Solaris SPARC (developed and tested under Solaris 8),and a beta version for MacOS X.
Off course you will get the phpMyAdmin with XAMPP well. Lets start using XAMPP.

Start downloading XAMPP here
» XAMPP for Windows
» XAMPP from SourceForge.net

AJAX Cross Domain

Virtually all modern server-side scripting languages support remote requests in one or another form. In client-side javascript, this functionality is not present due to the Same Origin Policy. Though this policy is necessary for a robust security model, programmers are often handicapped in their wish to send and retrieve requests to remote servers. During the last years, several proposals have been made for a more flexible (re-)design of the XMLHttpRequest object, which is the core mechanism of all AJAX based technologies. AJAX Cross Domain provides in the full functionality of the XMLHttpRequest object in a similar syntax, and can by extent handle all cross-domain requests. The core engine of AJAX Cross Domain is written in Perl and outputs its content as a javascript file.

Check out this URL for the solution: http://www.ajax-cross-domain.com/

Lets discover the Technology

Welcome here dear visitors! Technology simplifies the human works. But the developers are getting hectic while defining the technologies. Let get together to provide solutions for the developers' complex projects.

Here we can discuss on the topics listed below:

Web Development
  • PHP
  • MySQL
  • AJAX
  • Java Script
  • ASP, ASP.net
  • SQL Server
Web Hosting
  • Web Servers
  • Domain and TLDs
  • DNS
Software Development
  • .NET Technologies
  • Java Development
  • Mobile Applications