|  | Posted by Bonge Boo! on 07/02/06 18:09 
On 2/7/06 16:52, in article 9kqfa250r72epe0990gl6qklv9heu644fa@4ax.com,"Andy Hassall" <andy@andyh.co.uk> wrote:
 
 >
 >>>> // create a new curl resource
 >>>> $ch = curl_init();
 >>>> // set URL and other appropriate options
 >>>> curl_setopt($ch, CURLOPT_URL, $url);
 >>>> curl_setopt($ch, CURLOPT_HEADER, 0);
 >>>> curl_setopt($ch, CURLOPT_POST, 1);
 >>>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
 >>>> curl_setopt($ch, CURLOPT_REFERER, "http://www.blahbl.com/
 >>>> zippo/Search.ASP?WCI=AddToPortFolio");
 >>>> curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode($dezrez_query));
 >>>
 >>>  You've just encoded all the "&" and "=" separators; you should be encoding
 >>> the
 >>> keys and values separately and joining them up with "&" and "=".
 >>
 >> Done that. Still fails. I get returned a 1, which I assume indicates curl
 >> succeeded,
 >
 >  That depends on the options.
 >
 >> but nothing else returned to the $string I pass the result of the
 >> curl to.
 >
 >  With the settings above, cURL would just print the results to the browser,
 > not
 > return any content. See CURLOPT_RETURNTRANSFER.
 >
 >  If you want more information, ask for it using curl_getinfo(), curl_error(),
 > and CURLOPT_VERBOSE.
 
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_POST, 1);
 
 curl_setopt($ch, CURLOPT_REFERER, "http://www.blah.com/bibble/Search.ASP");
 curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $login_contents = curl_exec($ch);
 $error = curl_error($ch);
 print $error;
 print $login_contents;
 curl_close($ch);
 
 Pretty sure there is no curl error. Trying variations of this doesn't give
 me any feedback apart  from that 1.
 
 Capturing the data sent back and forth using curl and also the normal form
 posts, it looks like some cookie() are being sent as well during the form
 posts, which might explain why its not working in some browsers and isn't in
 others.  Ithought I had it pinned down to a id cookie for the domain, but
 apparantly not.
 
 I think I might as well give up on this before I it becomes an even bigger
 time-sucker.
 
 Thanks to all for your brains
  Navigation: [Reply to this message] |