Problem with curl
Posted: Sun Apr 22, 2007 2:21 pm
I want to make RSS to phpbb forum to a website.
Although it have RSS, It only contain the titles and not the content.
I try to do this:
but only here print.
What is the problem?
____________________________________________________________
I remove the line breaks in the array and now I get some output: "Empty reply from server"
What still is the problem?
__________________________________________________
I success with your forum to search after php.
I check the html code of whatsup and there is hidden field "sid" so I change the script to:
but nothing see.
What's the problem again?
Although it have RSS, It only contain the titles and not the content.
I try to do this:
Code: Select all
<?php
$ch = curl_init();
$post_data = array('search_keywords'=>'', 'search_terms'=>'any',
'search_author'=>"*", "search_forum"=>"-1",
"search_time"=>"1","search_fields"=>"all","search_cat"=>"-1",
"sort_by"=>"0", "sort_dir"=>"DESC", "show_results"=>"posts", "return_chars"=>"1000");
curl_setopt($ch, CURLOPT_URL, "http://whatsup.org.il/index.php?name=PNphpBB2&file=search&mode=results" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
else echo "here";
curl_close($ch);
?>What is the problem?
____________________________________________________________
I remove the line breaks in the array and now I get some output: "Empty reply from server"
What still is the problem?
__________________________________________________
I success with your forum to search after php.
I check the html code of whatsup and there is hidden field "sid" so I change the script to:
Code: Select all
<?php
$ch = curl_init();
$output=file_get_contents("http://whatsup.org.il/index.php?name=PNphpBB2&file=search");
preg_match('@input type="hidden" name="sid" value="([a-zA-Z1-9]+)@',$output,$matches);
$post_data = array('search_keywords'=>'', 'search_terms'=>'any', 'search_author'=>"*", "search_forum"=>"-1", "search_time"=>"1","search_fields"=>"all","search_cat"=>"-1", "sort_by"=>"0", "sort_dir"=>"DESC", "show_results"=>"posts", "return_chars"=>"1000", "sid"=>$matches[1]);
curl_setopt($ch, CURLOPT_URL, "http://whatsup.org.il/index.php?name=PNphpBB2&file=search&mode=results" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
else echo "here";
curl_close($ch);
?>What's the problem again?