Bug #36248 [Com]: CURLOPT_HEADERFUNCTION, couldn't set the function in the class (works in 5.1)

From: Date: Thu, 02 Feb 2012 19:11:15 +0000
Subject: Bug #36248 [Com]: CURLOPT_HEADERFUNCTION, couldn't set the function in the class (works in 5.1)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167068@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=36248&edit=1

 ID:                 36248
 Comment by:         brian at ontodevelopment dot com
 Reported by:        Admin at relax-info dot com
 Summary:            CURLOPT_HEADERFUNCTION, couldn't set the function in
                     the class (works in 5.1)
 Status:             Closed
 Type:               Bug
 Package:            cURL related
 Operating System:   WIN XP SP2
 PHP Version:        4.4.2
 Assigned To:        iliaa
 Block user comment: N
 Private report:     N

 New Comment:

http://ontodevelopment.blogspot.com/2011/04/curloptheaderfunction-tutorial-with.html


Previous Comments:
------------------------------------------------------------------------
[2007-01-12 16:38:46] iliaa@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2006-02-13 19:49:26] tony2001@php.net

Assigned to the maintainer.

------------------------------------------------------------------------
[2006-02-02 19:59:10] Admin at relax-info dot com

Ok, I then shall install MSVC6 and other debug packs.
Now I give you the reference to my class with an example.

Server: Apache/1.3.31 (Win32) PHP/4.4.2
X-Powered-By: PHP/4.4.2
Transfer-Encoding: chunked

http://relax-info.com/data/file/curl.class.php.rar
- example and class

With best regards, X-MAN :)

------------------------------------------------------------------------
[2006-02-01 21:18:06] tony2001@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Works perfectly fine here.

------------------------------------------------------------------------
[2006-02-01 17:55:12] Admin at relax-info dot com

I am truncate all comment from my class and delete other method than not assign with problem

<?php
class CURL
{
	var $url;
	var $header = false;
	var $returntransfer = false;
	var $_ch = null;

	function CURL($url = '')
	{
		$this->url = $url;
	}
	

	function init()
	{
		$this->_ch = curl_init();
		// ...
	}

	function execute()
	{
		//	defauukt setup
		curl_setopt($this->_ch, CURLOPT_URL, $this->url);
		
		// HEADER
		if ($this->header)
		{
			curl_setopt($this->_ch, CURLOPT_HEADER, true);	
			curl_setopt($this->_ch, CURLOPT_HEADERFUNCTION, array($this, '_header_callback');	
		}

		// exec
		$result = curl_exec($this->_ch);
		// ..

		return $result;	
	}
	
	function _header_callback($ch, $header)
	{
		return strlen($header);
	}
}
// EXAMPLE ---------------------
	$url = 'http://www.relax-info.com';
	
	$curl = new CURL($url);
	if ($curl->init())
	{
		$curl->returntransfer = true;
		$curl->header = true;
		
		$result = $curl->execute();
		print_r($result);
	}
	else echo $curl->get_error();
?>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=36248


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=36248&edit=1


Thread (9 messages)

« previous php.bugs (#167068) next »