I have the code below that I need to run it every hour. This script running through the browser, returns the data correctly. I wanted to run it via scheduled tasks, by CMD through the lines of execution:
c:/caminhocorreto/php -c c:/caminho/para/o/php.ini [ -f ] c:/caminho/para/o/script.php
or php -f c:/caminho/para/o/script.php
The problem with the first command, returns that it did not find the libraries (defined in php.ini):
Warning: PHP Startup: Unable to load dynamic library '${path}\binaries\php\ext\php_xsl.dll' - Não foi possível encontrar o módulo especificado. in Unknown on line 0
On the second command, it drops to catch
and returns me NULL. Trying to run a simple page.
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
header('Content-Type: text/html; charset=utf-8');
include('../includes/class.usuario.php');
include('../includes/conexao.php' );
$params = array(
'usuario' => $usuario,
'senha' => $senha,
'quantidade' => 10
);
$wsdl = 'http://site_de_consulta_webservice?WSDL';
$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
try {
$soap = new SoapClient($wsdl, $options);
$data = $soap->obterPacotePosicoes($params);
}
catch (SoapFault $fault){
echo "\n\n".$fault->getMessage();
}
$i = 0;
foreach($data->return as $posicao)
{
$cod_macro = $posicao->codigoMacro;
//INSERT DOS DADOS NO BANCO DE DADOS A CADA EXECUÇÃO DO SISTEMA!
}
Does anyone know if it's okay to query webservice via prompt? Or is there something wrong? And why does the first command fail to find the libs?
EDIT
C:\>php -v
PHP 5.4.24 (cli) (built: Jan 8 2014 20:26:31)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
C:\>php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
yaz
zip
zlib
[Zend Modules]
Xdebug