abdulsamad Posted October 26, 2008 Share Posted October 26, 2008 Ok guys here is the thing, i am trying to make a script which would first login into the syt bitroad.net and then would give a link in a field for remote uploading this is the script i have made but its not working... can anybody correct the script? remote upload text box is in "files" tab after logging in i have also cre8ed a fake id on tht site just for you guyz to see nd help login: noobster password: noob <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'http://bitroad.net'); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS,"login=username&password=password"); $page = curl_exec($ch); preg_match('/;(.*)\"/',$page,$matches); curl_setopt($ch, CURLOPT_URL,'http://bitroad.net'.$matches[1]); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS,"username=username&password=password&methodToCall=curl_exec($ch)"); curl_exec($ch); curl_setopt($ch, CURLOPT_URL,'http://bitroad.net/ftp/acc_file.php'.$matches[1]); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt ($ch, CURLOPT_POSTFIELDS, 'remote_file=$url'); $page = curl_exec($ch); ?> Link to comment https://forums.phpfreaks.com/topic/130176-curl-send-data/ Share on other sites More sharing options...
abdulsamad Posted October 27, 2008 Author Share Posted October 27, 2008 BUMP Link to comment https://forums.phpfreaks.com/topic/130176-curl-send-data/#findComment-675316 Share on other sites More sharing options...
thebadbad Posted October 27, 2008 Share Posted October 27, 2008 I'm not entirely sure what you are trying to do. But I've looked at the login form on the site, and if you want to login via cURL, you should try to send "log=username&pas=password" as the postfields, instead of what you're sending. You're also supposed to post to "http://bitroad.net/ftp/account.php" instead, since that's the action of the form. I think there's a problem with your preg_match() too. What are you trying to grab when you've logged in? The first match with /;(.*)\"/ is ; charset=iso-8859-1", but obviously that's not what you want. Link to comment https://forums.phpfreaks.com/topic/130176-curl-send-data/#findComment-675544 Share on other sites More sharing options...
abdulsamad Posted October 27, 2008 Author Share Posted October 27, 2008 well i don't entirely get what you are trying to say since i am new. Somewhere i saw coding in which for logging in he used setcookie() function. Do you think this will do the work here? Link to comment https://forums.phpfreaks.com/topic/130176-curl-send-data/#findComment-675591 Share on other sites More sharing options...
thebadbad Posted October 27, 2008 Share Posted October 27, 2008 No, setcookie() will not help you here. I've tried to play around a bit with cURL, but can't get it to POST on my locahost. Link to comment https://forums.phpfreaks.com/topic/130176-curl-send-data/#findComment-675620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.