The Little Guy Posted November 18, 2011 Share Posted November 18, 2011 I am doing this: $fields = array( "code" => $this->code, "secret" => $this->secret, "domain" => $_SERVER['HTTP_HOST'], ); $this->ch = curl_init(); curl_setopt($this->ch, CURLOPT_URL, "http://weblyize.com/API/v1"); curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($this->ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($this->ch, CURLOPT_POST, true); $opt = curl_exec($this->ch); return $opt; But the post fields are not being passed for some reason, and I can't figure out why. I do a print_r($_POST); on the url above, and it is empty. Do you see anything wrong with my curl? Here is the page: http://phpsnips.com/search/doSearch.php Quote Link to comment https://forums.phpfreaks.com/topic/251391-curl-post/ Share on other sites More sharing options...
xyph Posted November 18, 2011 Share Posted November 18, 2011 It's hard to say that it's not an issue on their side, because we can't test it. <?php $post = array( 'Comments'=>'Testing!', 'hidden field'=>'lalalala' ); $site = 'http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi'; $session = curl_init(); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); curl_setopt($session, CURLOPT_URL, $site); curl_setopt($session, CURLOPT_POST, true); curl_setopt($session, CURLOPT_POSTFIELDS, $post); $response = curl_exec($session); print_r($response); curl_close($session); ?> works. Quote Link to comment https://forums.phpfreaks.com/topic/251391-curl-post/#findComment-1289364 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.