Jump to content

curl send data


abdulsamad

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.