php - CURL GET request to an search form -


$url3 = "http://cocatalog.loc.gov/cgi-bin/pwebrecon.cgi?db=local&page=first"; $ch3 = curl_init();                   //2nd curl search asin  curl_setopt($ch3, curlopt_url,$url3); curl_setopt($ch3, curlopt_returntransfer, 1); curl_setopt($ch3, curlopt_timeout, 15); curl_setopt($ch3, 156, 2500); curl_setopt($ch3, curlopt_getfields,"?search_arg=$kindletitle&search_code=tall&cnt=25&hist=1"); curl_setopt($ch3, curlopt_ssl_verifyhost, 0); curl_setopt($ch3, curlopt_followlocation, true); $copyrightrecordresponse = curl_exec($ch3); curl_close($ch3); 

trying request following search form getting error curl_setopt() expects parameter 2 long, string given,

maybe missing why dont form request url beforehand? not sure trying accomplish see if works you:

$title='teste';  $url3="http://cocatalog.loc.gov/cgi-bin/pwebrecon.cgi?search_arg=$title&search_code=tall&cnt=25&hist=1";  $ch3 = curl_init();                   //2nd curl search asin  curl_setopt($ch3, curlopt_url,$url3); curl_setopt($ch3, curlopt_returntransfer, 1); curl_setopt($ch3, curlopt_timeout, 15); curl_setopt($ch3, 156, 2500);  curl_setopt($ch3,curlopt_httpget,true); curl_setopt($ch3, curlopt_ssl_verifyhost, 0); curl_setopt($ch3, curlopt_followlocation, true); $copy= curl_exec($ch3); curl_close($ch3);  echo($copy); 

this returns search results string stored in $title variable.

see reference link documentation curl options:

http://pt1.php.net/manual/en/function.curl-setopt.php

hope helped. :-)


Comments