cUrl

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I already told you ;)
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

In that case i think i ´m missing a post, cause i dont see it.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Like I said, you only need a single curl_init()
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Got it working.. :)

However still have one problem, Transfer Encoding: chunked. Any ideas on How to avoid that.

my Code now

Code: Select all

$cookie_jar = tempnam('/tmp','cookie');
	$cookie = "";
	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, "url/login.php");
	curl_setopt ($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, VERBOSE, 1);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar);
	curl_setopt($ch, CURLOPT_POSTFIELDS, "myPostFields");
	curl_exec($ch);
	curl_close($ch);

	$ch = curl_init();
	curl_setopt ($ch, CURLOPT_URL, "url/create-mailbox.php");
	curl_setopt ($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, VERBOSE, 1);
	curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar);
	curl_setopt($ch, CURLOPT_COOKIE, $cookie);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, "myPostFields");
	$response = curl_exec($ch);
	curl_close($ch);

Output
HTTP/1.1 200 OK
Date: Sat, 07 Apr 2007 19:31:05 GMT
Server: Apache/1.3.37 (Unix) PHP/5.2.0 with Suhosin-Patch mod_ssl/2.8.28 OpenSSL/0.9.7e-p1
X-Powered-By: PHP/5.2.0
Expires: Sun, 16 Mar 2003 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Last-Modified: Sat, 07 Apr 2007 19:31:06 GMT
Cache-Control: post-check=0, pre-check=0
Transfer-Encoding: chunked
Content-Type: text/html
rashmi
Forum Newbie
Posts: 3
Joined: Thu May 03, 2007 9:32 am

Post by rashmi »

I am developing web mail's addressbook importer using php.
I am using curl for this.

mine problem is : my script runs well on server apache Apache 2.0 +php PHP Version 4.4.2 +mysql

[1] when i tried same script on iis 6+ win 2k3 + php 5.2.1 - 1 script will not returns me the result othres works fine.

[2] when i tired the same script with WAMP - php 4.2 - not getting result appropriately

[3] I cann't connect to mssql in iis 6+ win 2k3 + php 5.2.1 configuration. i already copied enough files to system32 directory.

If anyone can help me in this problems please guide me soon.

with regards.

-Rashmi
Post Reply