cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Problem with CURL and session_start()

From: Russell Snella <rsnella_at_ajrintl.com>
Date: Wed, 12 Dec 2007 15:23:10 -0600

Your script worked fine, all I added as the start and stop php to the top
and bottom of the script.

I have seen this issue before if session_start() has been called already.

 

 

<?php

session_start();

$url = 'http://www.google.com';

$mycurl = curl_init();

curl_setopt($mycurl, CURLOPT_URL, $url);

curl_setopt($mycurl, CURLOPT_RETURNTRANSFER, true);

$retorno = curl_exec($mycurl);

echo($retorno);

curl_close($mycurl);

?>

 

 

Ajr Intl. Inc

Russell R. Snella

630-523-6411 DID

847-980-5826 Cell

 

-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Max Yahoo!
Sent: Wednesday, December 12, 2007 2:58 PM
To: curl-and-php_at_cool.haxx.se
Subject: Problem with CURL and session_start()

 

Hello everybody,

 

For some reason my PHP script hangs, no erros was returned by webserver,
when I put session_start(); into the script.

 

Linux hm223 2.4.21-47.ELsmp #1 SMP Wed Jul 5 20:38:41 EDT 2006 i686

Apache 2

PHP 5.1.6

CURL libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.1.4

 

Code sample

 

session_start();

$url = 'http://www.google.com';
$mycurl = curl_init();
curl_setopt($mycurl, CURLOPT_URL, $url);
curl_setopt($mycurl, CURLOPT_RETURNTRANSFER, true);
$retorno = curl_exec($mycurl);
echo($retorno);
curl_close($mycurl);

 

If I remove session_start() everything works fine.

 

Someone can help?

 

Best regards!

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

image001.jpg image002.gif
Received on 2007-12-12