Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php脚本中发布URL以移动网络摄像头_Php_Url - Fatal编程技术网

在php脚本中发布URL以移动网络摄像头

在php脚本中发布URL以移动网络摄像头,php,url,Php,Url,当我调用../axis cgi/com/ptz.cgi?gotoserverpresetname=Eis_links1&camera=1时,连接的网络摄像头正在移动到预设位置(我可以更改gotoserverpresetname的值并移动) 如何从php脚本调用此脚本? 我尝试了下面的代码,但什么也没发生 致意 阿德里亚娜 您需要一个GET请求: $myvar1="Eis_mitte"; $myvar2="1"; $url = '...my url....'; $myvars = '?gotos

当我调用
../axis cgi/com/ptz.cgi?gotoserverpresetname=Eis_links1&camera=1
时,连接的网络摄像头正在移动到预设位置(我可以更改
gotoserverpresetname
的值并移动)

如何从php脚本调用此脚本? 我尝试了下面的代码,但什么也没发生

致意 阿德里亚娜


您需要一个GET请求:

$myvar1="Eis_mitte";
$myvar2="1";

$url = '...my url....';
$myvars = '?gotoserverpresetname='.$myvar1 . '&camera='.$myvar2;

$ch = curl_init( $url.$myvars );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );

注意:在myvars中添加“?”并删除CURLOPT_POSTFIELDS

您使用CURLOPT_POSTFIELDS,但使用所需的URL传递GET参数。删除CURLOPT_POSTFIELDS并向$url字符串添加变量我将我的代码更改为(这是您建议的吗?$url='…域…/axis cgi/com/ptz.cgi?GotoServer预设名称=Eis_mitt&camera=1'$ch=curl_init($url)$响应=curl_exec($ch);但是凸轮仍然没有移动…我试过了,但是它仍然没有移动凸轮。。。在我的url中,我正在处理一个cgi脚本-…/axis cgi/com/ptz.cgi可能有问题?您确定构建了一个有效/正确的url吗?如果是,可能是PHP无法引用URL服务器配置或。。。我会尝试使用其他有效的URL来检查php是否可以与curl通信。我在终端中进行了尝试,在那里curl-我得到了“未找到”的结果…这对我的php脚本意味着什么?curl-i…我的域…/axis cgi/com/ptz.cgi?gotoserverpresetname=Eis_mitt&camera=1[1]3253 HTTP/1.0 302找到位置:/axis cgi/ptz/cookietest.cgi?cgipathref=ptz Set Cookie:ptz_ctl_id=37798;路径=/轴cgi/;expires=Sat,2014年2月22日17:34:35 GMTI试图添加curl_setopt($ch,CURLOPT_COOKIESESSION,TRUE);这没有帮助
$myvar1="Eis_mitte";
$myvar2="1";

$url = '...my url....';
$myvars = '?gotoserverpresetname='.$myvar1 . '&camera='.$myvar2;

$ch = curl_init( $url.$myvars );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );