curl使用get方法

时间:2018-04-22 11:05:20

标签: php curl get

我试图执行带参数的网址,以便将参数插入只能通过GET方法接收的网站。

如果我将表单方法设置为GET,则参数进入系统。

现在,我希望在插入数据后做一些事情。 我正在尝试使用curl来执行url。

这是代码:

<?php

$firstname = 'dav';
$lastname = 'sev';
$cellular = '321321321';
$mail = 'aaa@aaa.aaa';
$department = '';
$bagrut = 1;
$campid = 7;
$sourceid = 56;
$pirsumi = 0;


echo  $firstname  .' '. $lastname .' '. $cellular .' '.  $mail .' '.  $department .' '.  $bagrut .' '.  $campid .' '.   $sourceid  .' '.  $pirsumi;
$values = array(
    'FIRSTNAME' =>$firstname,
    'LASTNAME' => $lastname,
    'CELLULAR' => $cellular,
    'EMAIL' => $mail,
    'DEPARTMENT' => $department,
    'BAGRUT_ZAKAI' => $bagrut,
    'CAMPAIGNID' => $campid,
    'SOURCEID' => $sourceid,
    'SEND_MAIL_PIRSUMI' => $pirsumi

);


    $qry_str = http_build_query($values);
    $callurl = curl_init();
    $url = 'http://someurl.com?' . $qry_str;

    curl_setopt($callurl , CURLOPT_URL, $url);
    curl_setopt($callurl , CURLOPT_HEADER, 0);

    curl_exec($callurl);

    curl_close($callurl);

    echo $url;

?>

url输出正确但这是我在页面中收到的结果

Found
The document has moved.

http://someurl.com?FIRSTNAME=dav&LASTNAME=sev&CELLULAR=321321321&EMAIL=aaa%40aaa.aaa&DEPARTMENT=&BAGRUT_ZAKAI=1&CAMPAIGNID=7&SOURCEID=56&SEND_MAIL_PIRSUMI=0
  1. 这篇文章来自哪里? Found The document has moved.

  2. 我的代码出了什么问题?

  3. 是否有其他方法可以采取此行动?

  4. 由于

0 个答案:

没有答案