Jump to content

Problems with Curl


EchoFool

Recommended Posts

I have a simple curl script which sends a post to a website, but although it 100% works, my "or die( show ever) " part of the script still displays which makes no sense.... this is my script:

 

<?php
$curl_handle = curl_init ();
curl_setopt ($curl_handle, CURLOPT_URL,$row['IncentiveUrl']);
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, 'UserID='.$UserID);
$response = curl_exec ($curl_handle) or die ("There has been an error
connecting to your POST method site.");
curl_close ($curl_handle);
?>

 

It works perfect but it always shows:

 

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

 

Why might this be ?

Link to comment
https://forums.phpfreaks.com/topic/164138-problems-with-curl/
Share on other sites

Well i changed:

    $response = curl_exec ($curl_handle) or die ("There has been an error
    connecting to your POST method site.");

 

To:


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

 

 

and got this in return :

 

The error was: couldn't connect to host

 

Yes it did connect and send the post as the script that recieved the POST processed it.. =/

Link to comment
https://forums.phpfreaks.com/topic/164138-problems-with-curl/#findComment-865871
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.