I got a sample code from one of the sites.Its like this : Why this code is not working ? I doubt abt it ! Can anyone plz help with some other examples ?
It's impossible to tell without seeing the code inside gurl.php Perhaps you'll have more luck with this .... <? class curl { var $curl ; function curl( ) { if( !( $this->curl = curl_init( ) ) ) { die( "Cannot initialize curl, please make sure it is loaded" ); } curl_setopt( $this->curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $this->curl, CURLOPT_FOLLOWLOCATION, true ); } function request( $method, $url, $post = null ) { if( strtolower( $method ) == "post" ) { if( !curl_setopt( $this->curl, CURLOPT_POST, true ) ) die( sprintf( "Failed to setup curl post : %s", curl_error( $this->curl ) ) ); if( !curl_setopt( $this->curl, CURLOPT_POSTFIELDS, $this->_serialize( $post ) ) ) die( sprintf( "Failed to setup curl post data : %s", curl_error( $this->curl ) ) ); } if( !curl_setopt( $this->curl, CURLOPT_URL, $url ) ) { die( sprintf( "Failed to setup curl url : %s", curl_error( $this->curl ) ) ); } else { return curl_exec( $this->curl ); } } function _serialize( $post ) { foreach( $post as $key => $value ) { $result[ ] = sprintf( '%s=%s', $key, urlencode( $value ) ); } return implode('&', $result ); } } $curl = new curl ; /** POST EXAMPLE, you could replace the array( ) with $_POST if you're sendin a whole form echo $curl->request( 'POST', 'http://krakjoe.com/post-ajax.php', array( 'first' => 'Joe', 'last' => 'Watkins', 'age' => 23 )); **/ /** GET EXAMPLE echo $curl->request('GET', 'http://krakjoe.com' ); **/ ?> PHP:
Thankz ! It works ! But when I try to do it for some directory submission its not working ! Why its like that ?
directories often have other measures to make sure that the posted data has come from a form on the domain, I would firstly get ahold of the source to the directory you're using a do a search in it for $_SERVER to see if any other detection is going on, other than that the only thing I can think of is there are hidden form fields on the page filled by javascript onsubmit ( or not, if they were missing the data will still be incorrect ) and obviously you cannot use curl to submit forms that use captcha verification.
The value for CATEGORY_ID needs to be a number, as found in the value attribute of the option. Also, for some reason you're assigning $webresult (Wherever it comes from...), and later you're echoing $webresult, which apparently isn't the same. I can't test it since I don't have gurl.php. So I suggest you show some effort and try to do it yourself first, instead of asking us to "plz check it"... EDIT: You're also trying to put HTML code directly in a text area. You have to convert the HTML from the page to HTML entities. printf("Result:<br><textarea rows='20' cols='50'>%s</textarea><br>", htmlspecialchars($webresult)); PHP: