搜索
首页php教程php手册php实战第十四天

php实战第十四天

Jun 13, 2016 am 10:57 AM
curlhttppostphp函数实战扩展有效这个

今天学会了curl扩展的函数.写了一个 httpPost函数,恩是有效的,这个我想可以利用来做在线更新.或者是在线下载远程的资源.

[php]
echo httpPost("http://bbs.125.la/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1", 
               array ( 
                    "handlekey" => "ls", 
                    "password" => "123456", 
                    "quickforward" => "yes", 
                    "username" => "admin" 
            )); 
 
function httpPost($url,$sendData) 

 
 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    // 我们在POST数据哦!  
    curl_setopt($ch, CURLOPT_POST, 1); 
    // 把post的变量加上  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $sendData); 
    $output = curl_exec($ch); 
    curl_close($ch); 
    return $output; 

echo httpPost("http://bbs.125.la/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1",
      array (
        "handlekey" => "ls",
        "password" => "123456",
        "quickforward" => "yes",
        "username" => "admin"
   ));

function httpPost($url,$sendData)
{


 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 // 我们在POST数据哦!
 curl_setopt($ch, CURLOPT_POST, 1);
 // 把post的变量加上
 curl_setopt($ch, CURLOPT_POSTFIELDS, $sendData);
 $output = curl_exec($ch);
 curl_close($ch);
 return $output;
}

以下是标准的mysql查询数据并组合成数组的代码
[php]
$conn=mysql_connect('localhost','root','1234'); 
mysql_select_db('kefei'); 
mysql_query("set names utf8"); 
$result=mysql_query("select * from liuyan"); 
$arr=array(); 
while($row=mysql_fetch_assoc($result)){ 
    $arr[]=$row 

var_dump($arr); 

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!