在codeigniter中的curl [英] Curl in codeigniter

查看:635
本文介绍了在codeigniter中的curl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的codeigniter应用程序中使用curl。但我得到了空数组。

I want to use curl in my codeigniter application. But I am getting null array.

我的代码是这样:

$this->load->library('curl');
$url = "http://url/checkweb.php"; 
$post_data = array ( 
    "foo" => "bar", 
    "query" => "Nettuts", 
    "action" => "Submit" 
);
$output = $this->curl->simple_post($url, $post_data);

checkweb.php

print_r($_POST);

现在实际上我想传递当前的URL,它会检查它在我的私人数据库,如果它因此我的代码不能复制到其他域上

now actually I want to pass current url and it will check that its in my private database and if it is there then its ok else it will redirect to google.com because my code can't be copied on other domain

推荐答案

如果您使用的是cURL库,您应该已经达到最低限度。

If you're using the cURL library, you should have this at the bare minimum.

$this->load->library('curl');
$url = "http://url/checkweb.php"; 
$post_data = array ( 
    "foo" => "bar", 
    "query" => "Nettuts", 
    "action" => "Submit" 
);
$output = $this->curl->simple_post($url, $post_data);

这篇关于在codeigniter中的curl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆