English 中文(简体)
cURL 赢得触发点
原标题:cURL won t trigger setcookie
  • 时间:2012-01-14 00:09:45
  •  标签:
  • php
  • curl

我有一份正向文字发送标识的URL文字。

//open connection
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url;
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields1);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);
//open connection

该书有一套功能。

setcookie("cookie_email",$email,time()+(3600*24*$i),"/");
setcookie("cookie_password",$password,time()+(3600*24*$i),"/");

当我使用表格对表格进行标识时,一切照预期。 出于某种原因,当你管理着“URL”时,它跳了 set的功能。

我已走过网,我无法找到解决办法。 我不敢肯定为什么它未能建立 co。

非常赞赏朝着正确方向迈出的任何一步。

Thanks, Phil

UPDATE! - 接近

Okay I have made some changes that grab cookies and put them into a cookie file. Two Issues I set.
1. The cookied password in the file reads: deleted 2. The cookies aren t being set in the browser.

How do I get the md5($password) into the file and how does: curl_setopt($ch, CURLOPT_COOKIEFILE, cookies/cookies.txt ); set the cookies in the browser?

问题回答

你们必须确定CURL_COOKIEJAR和CURL_COOKIEFILE的治疗选择,以分别确定哪些厨师应当储存和装满。

EDIT: Your example rewritten:

//open connection
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url;
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields1);
curl_setopt($ch, CURLOPT_COOKIEJAR,  cookies/cookies.txt );
curl_setopt($ch, CURLOPT_COOKIEFILE,  cookies/cookies.txt );

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

假设你建立了名录库,并将在称为 co的档案中拯救 co。 txt(只要你的网络服务器能够向该名录写信,就会建立档案本身)

随后的请求将使用储存在厨师身上的任何厨师。 发出请求时的标记(假设你也为这一请求提供 co)





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签