Jump to content

Setup Curl() in apache?


EchoFool

Recommended Posts

I have gone into my apache/php.ini and allowed this line:

 

extension=php_curl.dll

 

 

But according to my script with curl involved it still gives me the same issue which is :

 

Fatal error: Call to undefined function curl_init()

 

Does any one know what other line in apache php.ini i have to enable to get this to work ?

 

Hope you can help.

Link to comment
https://forums.phpfreaks.com/topic/163440-setup-curl-in-apache/
Share on other sites

honestly if this still relating to that POST method question..  then you see the problem.. many webhosts might also have it shutdown.

 

anyways here is how it should be done

 

<?php
$data = "key=val&key2=val2&key3=val3&etc=etc.."
$curl_handle = curl_init ();
curl_setopt ($curl_handle, CURLOPT_URL,
"https://site.com/postscript.php");
curl_setopt ($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl_handle, CURLOPT_POST, 1);
curl_setopt ($curl_handle, CURLOPT_POSTFIELDS, $data);
$response = curl_exec ($curl_handle) or die ("There has been an error
connecting to your POST method site.");
curl_close ($curl_handle);
?>

Link to comment
https://forums.phpfreaks.com/topic/163440-setup-curl-in-apache/#findComment-862346
Share on other sites

Right got it working but i get:

 

There has been an error connecting to your POST method site.

 

Is this down to the settigs on my other server? If so what do i need to allow it to work ? What could be stopping it ?

 

are  u sure that site is real?

 

https://site.com/postscript.php = example plus it has https which is SSL (secure sealed layer? i think) security site..

 

replace it with

http://yoursite.com/YourScriptToPostTo.php

Link to comment
https://forums.phpfreaks.com/topic/163440-setup-curl-in-apache/#findComment-862452
Share on other sites

try replace

 

$response = curl_exec ($curl_handle) or die ("There has been an error

connecting to your POST method site.");

 

with

 

$response = curl_exec ($curl_handle) or die ("The error was: ". curl_error($curl_handle));

 

The error was: couldn't connect to host

 

But it did connect to the script, because the script executed perfectly.. ? So any ideas what its on about?

Link to comment
https://forums.phpfreaks.com/topic/163440-setup-curl-in-apache/#findComment-863501
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.