ajax to php to curl and back..
Posted
by pfunc
on Stack Overflow
See other posts from Stack Overflow
or by pfunc
Published on 2010-06-08T00:35:13Z
Indexed on
2010/06/08
0:42 UTC
Read the original article
Hit count: 326
I am trying to make an ajax call to a php script. The php script calls an rss feed using curl, gets the data, and returns the data to the funciton.
I keep getting an error
"Warning: Wrong parameter count for curl_error() in" ....
Here is my php code:1
$ch = curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_URL, $feed);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1 = curl_exec($ch) or die(curl_error());
echo $data1;
and the ajax call:
$.ajax({
url: "getSingleFeed.php",
type: "POST",
data: "feedURL=" + window.feedURL,
success: function(feed){
alert(feed);
}});
I tested all the variables, they are being passed correctly, I can echo them out. But this line: $data1 = curl_exec($ch) or die(curl_error());
is what is giving me the error. I am doing the same thing with curl on other pages, just without ajax, and it is working fine. Is there anything special I need to do with ajax to do this?
© Stack Overflow or respective owner