• support[@]kurinchilion.com
  • +1 (888) 666-4252

Blog

PHP: Program to pass data using character encoding (GET Parameter)

Oct 06, 2009 - by kurinchilamp // 346 Views
PHP program to pass data as GET parameters
<?php
// PHP 5 how to pass data as a query string
/*
http_build_query is a function in PHP 5 that enables you to URL encode the query string. You can pass an array or an array of array to this function. The default separator is "&"
*/

$data = array("first_name" => "Robert",
                "last_name" => "Brown",
                "address" => "123 Adam St., New York"
            );

// URI formatted with character encoding
$pass_string = "http://localhost/demo.php?".http_build_query($data, '');

echo "<h2>Query URI (using http_build_query)</h2><br />";
echo $pass_string;            
?>
Ouput from the above execution: Query URI (using http_build_query) http://localhost/demo.php?first_name=Robert&last_name=Brown&address=123+Adam+St.%2C+New+York
Continue Reading

PHP: How to receive the posted XML data?

Oct 05, 2009 - by kurinchilamp // 351 Views
Receive the posted XML data In order to test the posted data, we can create a file creation steps to ensure that we receive the posted data via the $_POST array
<?php
/* 
  File name: postdata2.php
*/
    $xmlFile = "xmlFile.txt";
    $fh = fopen($xmlFile, 'w') or die("Cannot open file");
    fwrite($fh, $_POST["xmldata"]);
    fclose($fh);



?>
Continue Reading

PHP: How to post XML data using CURL?

Oct 04, 2009 - by kurinchilamp // 420 Views
During integration projects or during such similar situations you may have across a necessity to transfer XML data or plain text file across server locations. Curl comes in handy during such scenarios. Following program is used to post XML data using Curl. In order for Curl to function, ensure that PHP settings has the curl module installed and that the libraries/dll libeay32, ssleay32 is installed in your server.
<?php
/* 
  File name: postdata.php
*/

$post_url = "http://localhost/demo/postdata2.php";
$xml_string = '<?xml version="1.0" encoding="UTF-8"?>
<books>
<book isbn="978-1594489587">
    <title>The Brief Wondrous Life of Oscar Wao</title>
    <publisher>Riverhead Hardcover </publisher>
    <amazon_price>14.97 </amazon_price>
    <author_firstname>Junot </author_firstname>
    <author_lastname>Diaz </author_lastname>
  </book>
<book isbn="999-1594489501">
    <title>A Thousand Splendid Suns </title>
    <publisher>Riverhead Hardcover </publisher>
    <amazon_price>14.27 </amazon_price>
    <author_firstname>Khaled </author_firstname>
    <author_lastname>Hosseini </author_lastname>
  </book>
</books>';


$ch = curl_init($post_url);

curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "xmldata=".$xml_string);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);


$data = curl_exec($ch); 
// to get information on the curl resultset
$info = curl_getinfo($ch);

if(curl_errno($ch)){
    print curl_error($ch);
}

curl_close($ch);

?>
Continue Reading

CakePHP: NuSoap web service call configuration

Sep 02, 2009 - by kurinchilamp // 331 Views
This is a beginner tutorial to help beginners make a call to "wsdl" files and for them to display the results returned by the service. First step is to include "nusoap.php" in \vendors folder in cakephp setup. In the controller, we make a call to nusoap.php by the statement App::import('Vendor','nusoap'); (more…)
Continue Reading

cakephp Deprecated: PHP 5.3 Wamp

Sep 01, 2009 - by kurinchilamp // 335 Views
Error message cakephp Deprecated: Assigning the return value of new by reference is deprecated You will see the above error message when you try to configure cakePHP framework using a Wamp Server installation and set the debug parameter as in Configure::write('debug', 2); Cause: CakePHP is not PHP 5.3 ready unlike the latest version of Zend framework. Remedy: Try downloading older version of PHP - e.g. PHP 5.2.9
Continue Reading

PHP removing deprecated related errors from display

Aug 31, 2009 - by kurinchilamp // 342 Views
To remove deprecated warning message displays when executing PHP programs, open php.ini file and ADD to it error_reporting = E_ALL & ~E_DEPRECATED This is the setting for the production environment where you would not like to display the deprecated function related errors. Sample error message Assigning the return value of new by reference is deprecated in nusoap.php on line 7381
Continue Reading

TECHNOLOGY DEV STACK

Following are some of the technologies that we use to build and maintain solutions for our clients.