Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Error: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set

Posted on 2008-06-24
5
Medium Priority
?
6,700 Views
Last Modified: 2009-06-23
I used the below code in http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23509647.html to post my form data to another script.jsp url, it is a payment checkout (should redirect to that)

<?php
$name = $_POST['name]';
$age = $_POST['age]';
$code = $_POST['code]';

$url1 = "http://your_first_script.jsp";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url1);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'name=$name&age=$age&code=$code'); // html form POST fields replace with your form data

curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

$result = curl_exec($ch);
curl_close($ch);
//echo $result;

//$url2 = "url2.php";
//....
//....
?>

I got an error:

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/public_html/html/send.php on line 47

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/public_html/html/send.php on line 57

However my php ver 4.4.8 has safe mode off and open basedir is not set

Any idea?
0
Comment
Question by:jedistar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 21855372
Try:
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
0
 

Author Comment

by:jedistar
ID: 21855593
Got a warning first for 2 secs, then it redirects to the page.

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/public_html/html/send.php on line 48

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/public_html/html/send.php on line 58

HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=0B1225EC74E0D9584C5E1E722E541727; Path=/ Content-Type: text/html Content-Length: 2189 Date: Tue, 24 Jun 2008 13:59:13 GMT

How do i remove the warning?
0
 
LVL 82

Expert Comment

by:hielo
ID: 21855612
>>How do i remove the warning?
try:
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
0
 

Author Comment

by:jedistar
ID: 21855650
Its left with stalling at this page for 2 secs showing:

HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=B7B188B4AED2C1F76963DC6A061110F6; Path=/ Content-Type: text/html Content-Length: 2189 Date: Tue, 24 Jun 2008 14:06:40 GMT
0
 
LVL 82

Accepted Solution

by:
hielo earned 1400 total points
ID: 21855699
Try:
curl_setopt($ch, CURLOPT_HEADER, 0);
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question