2

I have a php script in which i'm making curls which works on one server, but not another.

When attempting to use it I get errors such as the following

Notice: Use of undefined constant CURLOPT_POST - assumed 'CURLOPT_POST'

Notice: Use of undefined constant CURLOPT_POSTFIELDS - assumed 'CURLOPT_POSTFIELDS'

In the script I have

$options = array( 
CURLOPT_POST           => true,
CURLOPT_POSTFIELDS     => $data,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER         => true,    
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_AUTOREFERER    => true,    
CURLOPT_CONNECTTIMEOUT => 120, 
CURLOPT_TIMEOUT        => 120,      
); 

$ch  = curl_init( $url ); 
curl_setopt_array( $ch, $options ); 
$content = curl_exec( $ch ); 

I don't know much about curling so I'm assuming its something to do with maybe the versions of php on the different servers?

If anyone could point me in the right direction it would be much appreciated!

2
  • 1
    maybe that helps... stackoverflow.com/questions/22713591/… Commented Oct 25, 2015 at 19:30
  • I saw that however I don't have the 'extension=php_curl.dll' anywhere in my files! Commented Oct 25, 2015 at 19:40

1 Answer 1

1

Problem was php has its own separate curl module.

Ran

sudo apt-get install php5-curl

and problem solved!

Thanks to the guys who discussed it here

https://forum.owncloud.org/viewtopic.php?f=26&t=19911

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.