Tuesday, July 23, 2013

Using CURL to get XML

if you have an IP restricted XML service you can put this script on the server to reflect the xml :


<?php
header("Content-type: text/xml");
function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
echo get_data("YOUR XML URL");
?>

Java and php integration

If you need Java integration in PHP 5 +, there is the Java bridge of Zend Server:

  http://www.zend.com/en/products/server-ce/
 


or use the following  "PHP/Java Bridge":

  http://php-java-bridge.sourceforge.net/pjb/

Solve sohosin problems with cpanel

Solve sohosin problems with cpanel:

# remove suhosin from easyapache php config
/usr/local/cpanel/scripts/phpextensionmgr uninstall PHPSuHosin
# download and install older suhosin
wget http://download.suhosin.org/suhosin-0.9.31.tgz
tar zxf suhosin-0.9.31.tgz
cd suhosin-0.9.31
phpize
./configure
make
make install
#open php.ini and add line loading suhosin
vi /usr/local/lib/php.ini
and paste following line into section where you add extensions
extension=”suhosin.so”