void_set Posted October 8, 2013 Share Posted October 8, 2013 I am trying to connect to cryptochat.pw chat service via php but i cant, can you tell me whats going wrong pls. <?php $curl_header = array('X-Requested-With: XMLHttpRequest'); // POST the login details along with other required details to the login process page $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'http://cryptochat.pw/'); curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 2); curl_setopt($ch, CURLOPT_POST,2); curl_setopt($ch, CURLOPT_POSTFIELDS,urlencode('nick=test&name=aWJuRXozaWhBWHVIODZIY3QrbUJXbGtpTElqazUwUGZEbEU3TzduaUl2UGwzVnU4c2dXYnFtaXVyellSRXZWc2dTQzdQQXdUTXhrMDd1NHZQa1hPQ3c9PQ')); curl_setopt($ch, CURLOPT_COOKIEJAR, './cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, './cookies1.txt'); curl_exec($ch); // Once logged in, we use the same Cookies to allow us to view the home page // Change the url to point to any page within the InvisionPower website that requires login $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://cryptochat.pw/index.php?chat=aWJuRXozaWhBWHVIODZIY3QrbUJXbGtpTElqazUwUGZEbEU3TzduaUl2UGwzVnU4c2dXYnFtaXVyellSRXZWc2dTQzdQQXdUTXhrMDd1NHZQa1hPQ3c9PQ&pos=0"); curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_header); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, './cookies1.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, './cookies1.txt'); $result = curl_exec($ch); echo $result; // Close the cURL to free up resources curl_close($ch); ?> Quote Link to comment https://forums.phpfreaks.com/topic/282797-phpcurl-post-to-chat/ Share on other sites More sharing options...
.josh Posted October 8, 2013 Share Posted October 8, 2013 What errors are you getting? Have you tried using curl_error and curl_errno to determine? Quote Link to comment https://forums.phpfreaks.com/topic/282797-phpcurl-post-to-chat/#findComment-1453144 Share on other sites More sharing options...
jazzman1 Posted October 8, 2013 Share Posted October 8, 2013 Most of the chat programs on the web using javascript and AJAX to handle the data. I'm not entirely sure how you can manipulate JS by cURL. Quote Link to comment https://forums.phpfreaks.com/topic/282797-phpcurl-post-to-chat/#findComment-1453172 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.