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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.