CURL Aviosys IP9258 HTTP Command PHP works with include turned off!

<?
if(isset($_POST['ON']))
{
// make sure curl is installed
if (function_exists('curl_init')) {
// initialize a new curl resource
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, 'http://login:password@99.999.11.118/Set.cmd?CMD=SetPower+P60=1');
// set the port
//curl_setopt($ch, CURLOPT_PORT, "219");
// don't give me the headers just the content
curl_setopt($ch, CURLOPT_HEADER, 0);
// return the value instead of printing the response to browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// use a user agent to mimic a browser
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
$content = curl_exec($ch);
// remember to always close the session and free all resources
curl_close($ch);
} else {
echo "error";
}
}
if(isset($_POST['OFF']))
{
// make sure curl is installed
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://login:password@99.999.11.118/Set.cmd?CMD=SetPower+P60=0');
//curl_setopt($ch, CURLOPT_PORT, '219');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
$content = curl_exec($ch);
curl_close($ch);
} else {
echo "error";
}
}
?>
<html>
<head>
<!--<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Power Tree</title>
</head>
<body>
<form method="post" name="post_on">
<!--
<input type="hidden" name="ON" value="ON" />
<a onclick="javascript: document.post_on.submit();">Power Tree All - On</a>
-->
<input type="submit" name="ON" value="Power Tree - All - On" />
</form>
<br />
<form method="post" name="post_off">
<input type="submit" name="OFF" value="Power Tree - All - Off" />
</form>
<br />
<div id="content"><? if($content){ echo $content; } ?></div>

Posted on 11 Dec 2009, 14:18 - Category: Php
Comments - Edit - Delete


Php require_once() include_path

//echo get_include_path();

just alter
define('ABS_DOC_ROOT', $_SERVER['DOCUMENT_ROOT'] ."/zendlogin/httpdocs/");

duh, because docroot is different on the server, that's the whole beauty of this

Posted on 5 Nov 2009, 13:37 - Category: Php
Comments - Edit - Delete


Php form isset simple auth login

if (!isset($_POST['email']))
{
}
else
{
{

http://devzone.zend.com/article/646

Posted on 5 Nov 2009, 11:25 - Category: Php
Comments - Edit - Delete


Php array_map apply callback to all elements of an array, return the array as before

$_POST = array_map('trim',$_POST);

very nice

Posted on 1 Nov 2009, 17:03 - Category: Php
Comments - Edit - Delete


Php php.ini location xampp

xampp/php/php.ini

not so!

xampp/apache/bin/php.ini
!!!!

Posted on 9 Nov 2009, 1:12 - Category: Php
Comments - Edit - Delete


Pages: [1] [2] [3] [4] [5] ...
Loading