Yesideez Posted August 2, 2010 Share Posted August 2, 2010 Here's my script: <?php $ch=curl_init('http://www.pictureinthesky.net/bltest/method1.php'); curl_setopt($ch,CURLOPT_COOKIEJAR,'cookie.txt'); curl_setopt($ch,CURLOPT_COOKIEFILE,'cookie.txt'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_HEADER,false); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,'crime=1&vercode=ABC'); $page=curl_exec($ch); if (curl_errno($ch)) { echo 'ERROR'; } curl_close($ch); echo $page; ?> I'm trying to get that to call the URL in the script to check the anti XSS code in my other script is working but all it does is read the page in without submitting the form -I should get an error message! I've checked and the cookie.txt file is being created and contains: # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. www.pictureinthesky.net FALSE / FALSE 0 PHPSESSID 7268ef0b4b6adae605156ac177bdd43e EDIT: The above script can be tried: http://www.pictureinthesky.net/curl/readpage.php I think it might be failing because cURL hasn't been told the name of the submit button and in my code I'm checking for it by name. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 2, 2010 Author Share Posted August 2, 2010 UPDATE: Tried adding the name of the submit button on the end and it still fails. Doesn't pick up anything. curl_setopt($ch,CURLOPT_POSTFIELDS,'crime=1&vercode=ABC&subcrime'); Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 2, 2010 Author Share Posted August 2, 2010 UPDATE: I've set a referer and that is being picked up. Used Firebug to check XMLHttpRequests and not a single POST is being sent - no idea why! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 2, 2010 Author Share Posted August 2, 2010 Anyone know what can cause cURL not to send the POST data? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 3, 2010 Author Share Posted August 3, 2010 Anyone? Quote Link to comment Share on other sites More sharing options...
Farkie Posted August 3, 2010 Share Posted August 3, 2010 Hi Yesideez, After playing around, you need to add "subcrime=Commit" to the end of your POST fields, Farkie Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 3, 2010 Author Share Posted August 3, 2010 Thanks Farkie - I'll give that a go now - I owe you one pulled my hear out last night over this! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted August 3, 2010 Author Share Posted August 3, 2010 Thanks - it worked!!! http://www.pictureinthesky.net/curl/readpage.php Quote Link to comment 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.