Hello,
Im trying to make a script, that connect and login to other site, and get the data from him.But no success for now.
Code:
<?php
  $site = 'http://domain.com/sub/';
  $export_path = 'sub2/clientinfo.php?clientid=';
  $targets = array('1647');

  // get login form
  $crl = curl_init();
  $url = $site."login.php";
  curl_setopt($crl, CURLOPT_URL, $url);
  curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($crl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt");
  $result=curl_exec($crl);
  $info = curl_getinfo($crl);
  if ($info['http_code'] != 200) {
    die("expected http code 200. got ".$info['http_code']);
  }

  // login
  $crl = curl_init();
  $url = $site."/login.php";
  curl_setopt($crl, CURLOPT_URL, $url);
  curl_setopt($crl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
  curl_setopt($crl, CURLOPT_COOKIEJAR, "/tmp/cookie.txt");
  curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($crl, CURLOPT_POST, 1);

  $postdata=array(
    "login" => 'loginname',
    "pass" => "password",
    "op" => "loginf",
  );
  curl_setopt ($crl, CURLOPT_POSTFIELDS, $postdata);

  $result=curl_exec($crl);
  $headers = curl_getinfo($crl);
  if ($headers['url'] == $url) {
      var_dump($headers);
      die("Cannot login.");
  }

  // access paths to do export
  foreach ($targets as $target) {
    $uri = $site.$export_path.$target;

   $crl=curl_init();
    curl_setopt($crl,CURLOPT_URL, $uri);
    curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($crl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
    curl_exec($crl);
    curl_close($crl);

  }
?>
but when I open it.. I got
Code:
Not Found

The requested URL /client.php was not found on this server.
Can someone tells me where is my problem?