Jump to content

PHP/cURL POST to Chat


void_set

Recommended Posts

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);
?>
Link to comment
https://forums.phpfreaks.com/topic/282797-phpcurl-post-to-chat/
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.