search
HomeBackend DevelopmentPHP Tutorial post提交中的变量赋值有关问题

post提交中的变量赋值问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php $domain = "user.baidu.net";
$port = 80;
$uri = "/reg.php?cont=store_user";
$refe = "http://user.baidu.net/reg.php";
$num=1; //data中的变量num ,如果想要取变量1---100 怎么写
$data    ="lang=Chinese&username=popo{$num}&password1=123456&password2=123456&mobile=&email=&srvid=1&textarea=%E6%8F%90%E7%A4%BA%EF%BC%9A%E8%AF%B7%E4%BB%94%E7%BB%86%E9%98%85%E8%AF%BB%E4%BB%A5%E4%B8%8B%E6%9D%A1%E6%AC%BE%EF%BC%8C%E5%86%8D%E6%B3%A8%E5%86%8C%E5%B8%90%E5%8F%B7%E3%80%82%E4%BD%BF%E7%94%A8%E6%9C%AC%E7%BD%91%E7%AB%99%E8%A1%A8%E7%A4%BA%E6%82%A8%E5%90%8C%E6%84%8F%E9%81%B5%E5%AE%88%E8%BF%99%E4%BA%9B%E6%9D%A1%E6%AC%BE%E5%92%8C%E6%9D%A1%E4%BB%B6%E3%80%82%E5%A6%82%E6%9E%9C%E6%82%A8%E4%B8%8D%E6%8E%A5%E5%8F%97%E8%BF%99%E4%BA%9B%E6%9D%A1%E6%AC%BE%EF%BC%88%E2%80%9C%E6%9D%A1%E6%AC%BE%E2%80%9D%EF%BC%89%EF%BC%8C%E8%AF%B7%E5%8B%BF%E6%B3%A8%E5%86%8C%E3%80%82&acceptterms=1&adduser=%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7";
$protocolstr = "POST {$uri} HTTP/1.1\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\nReferer: {$refe}\r\nAccept-Language: zh-cn\nContent-Type:application/x-www-form-urlencoded\nAccept-Encoding: gzip, deflate\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; 360SE)\nHost: {$domain}\nContent-Length: 702\nConnection: Keep-Alive\nCache-Control: no-cache\nCookie: login_user=aabbcc02; PHPSESSID=hs23i9tguang96k7del3oafc64; lzstat_uv=2113815751356026816|2652038; lzstat_ss=2265145365_0_1335089150_2652038\n\n{$data}";
for ($i=1;$i<10;$i++){  //这里循环 赋值不起作用
$num=$i;
$sock = fsockopen($domain, $port, $errno, $errstr, 30);
if (!$sock) die("$errstr ($errno)\n"); 
fputs($sock, $protocolstr);
fgets($sock, 4096);
echo $num."  ";
}
fclose($sock);   

?>  







------解决方案--------------------
PHP code
<?php for ($i=1;$i<10;$i++){
    $num=$i;
    $data="lang=Chinese&username=popo{$num}&password1=123456&password2=123456&mobile=&email=&srvid=1&textarea=%E6%8F%90%E7%A4%BA%EF%BC%9A%E8%AF%B7%E4%BB%94%E7%BB%86%E9%98%85%E8%AF%BB%E4%BB%A5%E4%B8%8B%E6%9D%A1%E6%AC%BE%EF%BC%8C%E5%86%8D%E6%B3%A8%E5%86%8C%E5%B8%90%E5%8F%B7%E3%80%82%E4%BD%BF%E7%94%A8%E6%9C%AC%E7%BD%91%E7%AB%99%E8%A1%A8%E7%A4%BA%E6%82%A8%E5%90%8C%E6%84%8F%E9%81%B5%E5%AE%88%E8%BF%99%E4%BA%9B%E6%9D%A1%E6%AC%BE%E5%92%8C%E6%9D%A1%E4%BB%B6%E3%80%82%E5%A6%82%E6%9E%9C%E6%82%A8%E4%B8%8D%E6%8E%A5%E5%8F%97%E8%BF%99%E4%BA%9B%E6%9D%A1%E6%AC%BE%EF%BC%88%E2%80%9C%E6%9D%A1%E6%AC%BE%E2%80%9D%EF%BC%89%EF%BC%8C%E8%AF%B7%E5%8B%BF%E6%B3%A8%E5%86%8C%E3%80%82&acceptterms=1&adduser=%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7";
    $protocolstr = "POST {$uri} HTTP/1.1\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\nReferer: {$refe}\r\nAccept-Language: zh-cn\nContent-Type:application/x-www-form-urlencoded\nAccept-Encoding: gzip, deflate\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; 360SE)\nHost: {$domain}\nContent-Length: 702\nConnection: Keep-Alive\nCache-Control: no-cache\nCookie: login_user=aabbcc02; PHPSESSID=hs23i9tguang96k7del3oafc64; lzstat_uv=2113815751356026816|2652038; lzstat_ss=2265145365_0_1335089150_2652038\n\n{$data}";
    $sock = fsockopen($domain, $port, $errno, $errstr, 30);
    //....
} <div class="clear">
                 
              
              
        
            
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
python WSGI Application原理是什么python WSGI Application原理是什么May 19, 2023 pm 01:25 PM

本篇文章所依赖的python环境为:什么是WSGIWSGI也称之为web服务器通用网关接口,全称是webservergatewayinterface。它定义了在python中web服务器与web应用程序之间应该如何通信并且处理http请求和响应的一个标准,注意,它只是一个协议,或者说是规范、标准,你也可以不按这个标准来,就像我们上一篇文章所写的web服务器那样。WSGI也分为应用程序和服务器网关,其中我们熟知的Flask就是属于应用程序,uWSGI、wsgiref属于服务器网关。个人感觉,WSG

如何免费使用Bing Image Creator如何免费使用Bing Image CreatorFeb 27, 2024 am 11:04 AM

本文将介绍七种利用免费的BingImageCreator获得高质量输出的方法。BingImageCreator(现称为MicrosoftDesigner的ImageCreator)是一个出色的在线人工智能艺术生成器之一。它能根据用户的提示生成高度逼真的视觉效果。提示越具体、清晰和创意,生成的效果也会更出色。BingImageCreator在创建高质量图像方面取得了重大进展。它现在使用Dall-E3培训模式,显示出更高水平的细节和现实主义。然而,它能否始终如一地生成高清结果取决于几个因素,包括快速

小米手机image怎么删除小米手机image怎么删除Mar 02, 2024 pm 05:34 PM

小米手机image怎么删除?在小米手机中是可以删除image,但是多数的用户不知道image如何的删除,接下来就是小编为用户带来的小米手机image删除方法教程,感兴趣的用户快来一起看看吧!小米手机image怎么删除1、首先打开小米手机中的【相册】功能;2、然后勾选不需要的图片,点击右下角的【删除】按钮;3、之后点击最顶部的【相册】进入到专区,选择【回收站】;4、接着直接点击下图所示的【清空回收站】;5、最后直接点击【永久删除】即可完成。

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

AMP是什么币?AMP是什么币?Feb 24, 2024 pm 09:16 PM

什么是AMP币?AMP代币是由Synereo团队于2015年创立,作为Synereo平台的主要交易货币。AMP代币旨在通过多种功能和用途,为用户提供更好的数字经济体验。AMP代币的用途AMP代币在Synereo平台中拥有多重角色和功能。首先,作为平台的加密货币奖励系统的一部分,用户能够通过分享和推广内容来获得AMP奖励,这一机制鼓励用户更积极地参与平台的活动。AMP代币还可用于在Synereo平台上推广和传播内容。用户可以通过使用AMP代币提升他们的内容在平台上的曝光率,以吸引更多观众来查看和分

Imagemagic安装Centos及Image安装教程Imagemagic安装Centos及Image安装教程Feb 12, 2024 pm 05:27 PM

LINUX是一种开源的操作系统,它的灵活性和可定制性使得它成为了许多开发者和系统管理员的首选,在LINUX系统中,图像处理是一个非常重要的任务,而Imagemagick和Image是两个非常流行的图像处理工具,本文将为您介绍如何在Centos系统中安装Imagemagick和Image,并提供详细的安装教程。Imagemagic安装Centos教程Imagemagick是一个功能强大的图像处理工具集,它可以在命令行下执行各种图像操作,以下是在Centos系统上安装Imagemagick的步骤:1

SpringBoot之bootstrap和application的区别是什么SpringBoot之bootstrap和application的区别是什么May 16, 2023 pm 05:46 PM

bootstrap和application的区别说明bootstrap和application都是SpringBoot项目中的配置文件,他们的区别主要有以下的几个方面(1)加载顺序区别bootstrap配置文件是比application配置文件优先加载的,因为bootstrap是由spring父上下文加载,而application是由子上下文加载(2)优先级区别bootstrap加载的配置信息是不能被application的相同配置覆盖的,如果两个配置文件同时存在,也是以bootstrap为主(

Web Application核心防御机制是什么Web Application核心防御机制是什么May 11, 2023 pm 08:46 PM

为防止恶意输入,应用程序实施了大量的安全机制,而这些安全机制在概念上都具有相似性。这些安全机制由以下几个方面组成:1、处理用户访问web应用程序的数据与功能(防止未授权访问)2、处理用户对web应用程序功能输入的数据(防止构造恶意数据)3、应对攻击(处理预料外的报错、自动阻止明显的攻击、自动向管理员发送警报、维护程序的访问日志)4、管理与维护应用程序处理访问通常一个应用程序的用户有不同类型如,普通用户、登录验证用户、管理员。对不同用户web应用程序给予不同的权限,他们只能访问不同的数据与功能。w

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.