Hey--
Never use CurL that much, and now that I want to use it I'm having some problems.
I want to search for a term in Wikipedia. I have two versions, both of them don't seem to work.
I get a http problem, saying that the document has been moved. Of course, seeing that the file is 'Special:Search' I would except a problem like that...
<?
$url="http://www.wikipedia.org/wiki/Special:Search";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "search=php&go=Go&fulltext=search");
//Not sure what the last & does after the last 'search'? Do i need one?
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
print $content;
curl_close ($ch);
?>
Now I had first tried to search using the front page--
<?
$url="http://www.wikipedia.org/search-redirect.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "search=php&lang=en&go=Go&");
#curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);
print $content;
?>
I just get a '1' from that, probably the 1 that I specified at the RETURNTRANSFER part...
Any tips?
Thanks!