Lanibox
Lanibox

Reputation: 43

cURL is not working? No errors but doesnt work

im having problem with cURL...

My code:

            $ffmpegExecUrl = preg_replace('/(([^\/]+?)(\.php))$/', "exec_ffmpeg.php", "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
            $postData = "cmd=".urlencode($exec_string)."&token=".urlencode($this->_uniqueID);
            $strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $ffmpegExecUrl);
            curl_setopt($ch, CURLOPT_POST, TRUE);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            curl_setopt($ch, CURLOPT_TIMEOUT, 1);
            curl_setopt($ch, CURLOPT_COOKIE, $strCookie);
            curl_exec($ch);
            curl_close($ch);

I got cURL enabled in my host and its not giving any error on error_log, but it just doesnt go to that exec_ffmpeg.php...

Any suggestions?

Upvotes: 1

Views: 1139

Answers (3)

Wiz Cat
Wiz Cat

Reputation: 163

Can you try and put a "hardcoded" URL to see if that works for you? This would check if your regular expression works or not.

At least you can print "$ffmpegExecUrl" to a logfile.

Try to make the timeout longer than 1 or just comment out the entry for the test.

Please give us the results you get so we can try and help you further.

Upvotes: 0

Chris
Chris

Reputation: 5615

You will also need the cURL extension enabled in the PHP.ini if you haven't already. Actually thinking about it - it would likely have complained about cURL being unknown

Upvotes: 0

rudi
rudi

Reputation: 791

If you set "curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);" you have to catch the transfer:

$response = curl_exec($ch);

Upvotes: 1

Related Questions