代码之家  ›  专栏  ›  技术社区  ›  jax

将数据发布到同一站点上的另一个Joomla页面

  •  0
  • jax  · 技术社区  · 15 年前

    我有一个Joomla控制器,它在一些Google签出XML代码上迭代多次。我想要的是在这个迭代过程中,将数据发布到另一个页面-在同一个站点中。

    com_mycomponent/controllers/checkout_iterator.php //breaks up the xml into small parts and posts then to the executor, one at a time
    com_mycomponent/controllers/checkout_executor.php //does the real work for each XML element it is passed
    

    iterator.php控制器将向executor.php发送数据2次甚至50次。

    我该怎么做?

    2 回复  |  直到 15 年前
        1
  •  1
  •   greg0ire    15 年前

    要在php中将数据发布到页面,可以使用 cURL 延伸

        2
  •  0
  •   Alex K    15 年前

    一个又快又脏的方法可能是这样。。

    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, 'com_mycomponent/controllers/checkout_executor.php');
    curl_setopt($c, CURLOPT_HEADER, false);
    curl_setopt($c, CURLOPT_POST, true);
    
    // send data
    curl_setopt($c, CURLOPT_POSTFIELDS, 'a=1&b=2..');
    curl_exec($c);
    // other data.. we can use same handle
    curl_setopt($c, CURLOPT_POSTFIELDS, 'a=1&b=2..');
    curl_exec($c);
    
    // don't forget to close
    curl_close($c);
    
    推荐文章