2

I am trying to login here http://studio.smartshoot.com/filmmaker/home using CURL, but can't seem to get it to work.The result is it says "JavaScript is not enabled in your browser. Please enable JavaScript in your browser settings before continuing to use this site."

So far, I've tried the following:

<?

$username="username"; 
$password="password"; 
$url="http://ABC.COM?q=login&destination=filmmaker%2Fhome";
$cookie="cookie.txt"; 

$postdata = "name=".$username."&pass=".$password."&edit-user-login=user_login&edit-name=".$username."&remember_me=1"; 



$ch = curl_init(); 
curl_setopt ($ch, CURLOPT_URL, $url); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); 
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie); 
curl_setopt ($ch, CURLOPT_REFERER, $url); 

curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt ($ch, CURLOPT_POST, 1); 
$result = curl_exec ($ch); 

echo $result;  

curl_close($ch);
?>
user580950
  • 3,558
  • 12
  • 49
  • 94

2 Answers2

3

the answer's in the question. cURL does not execute JavaScript, so even if you're logged in you'll get whatever message the authors intended for a noscript user-agent.

Tim
  • 8,036
  • 2
  • 36
  • 52
  • So what is the alternate method ? – user580950 Jun 19 '13 at 14:58
  • You specified your goal as logging in. You may well have achieved that. However if your goal goes beyond that, then please specify what you're trying to do. – Tim Jun 19 '13 at 15:07
  • my goal is to login thats it – user580950 Jun 19 '13 at 15:16
  • 1
    the Javascript message probably has nothing to do with it. For a start the form field with the value `user_login` is called `form_id` not `edit-user-login`. – Tim Jun 19 '13 at 15:44
0

This is simple like this - a page tests, if you have JavaScript enabled, by using the JavaScript to execute a command, that will remove things like "you don't have JavaScript enabled".

Therefore, if you do NOT have JS enabled, the error won't go away.

Optionally (and even more likely) the JavaScript will REDIRECT your browser to the actual page, if JS is not enabled - again, you will stay at the first page, which says you don't have JS enabled...

PHP curl is NOT a full browser. It is just a library that is used for communicating with servers, using HTTP, FTP, et cetera. It does not do neither rendering nor parsing.

For this functionality, you would need a JavaScript engine... to my knowledge there is not one in PHP that is fully functional.

0x_Anakin
  • 3,229
  • 5
  • 47
  • 86