kostenloser Webspace werbefrei: lima-city


Suche auf lima-city

  • in: PHP curl erstellt keine cookie.txt, woran liegt das?

    geschrieben von spritchworks

    Ok danke für den Hinweis, dann lass ich das jetzt bleiben.
  • in: PHP curl erstellt keine cookie.txt, woran liegt das?

    geschrieben von spritchworks

    Naja, danke erstmal.
    Wo steht denn, dass man das nicht darf?
  • in: PHP curl erstellt keine cookie.txt, woran liegt das?

    geschrieben von spritchworks

    Hallo Leute,
    ich probiere momentan eine Proxy per php zu schreiben, der funktioniert auch ganz gut und auf meinem localhost, dort speichert er auch die Cookies in eine cookie.txt, doch wenn ich das ganze hier auf lima-city testen will dann speichert er seltsamer Weise die Cookies nicht und erstellt auch keine cookie.txt, könnte das eventuell an den Schreibrechten liegen wenn ja welche muss man setzen, ich hab schon alles mögliche probiert, ich hab auch schon die rechte auf 0777 gesetzt, aber es funktioniert trotzdem nicht, er speichert die Cookies nicht in die cookie.txt.

    Hier mal mein Code:
    <?php
    $url = "http://www.example.com";
    $content = '';
    GET_CONTENT($url);
    echo $content;
    function GET_CONTENT($Url) {
    	global $content;
    	$cookiePath = "cookie.txt";
    	$ch = curl_init($Url);
    	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    	curl_setopt($ch, CURLOPT_COOKIESESSION, false);
    	curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiePath);
    	curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiePath);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
    	curl_setopt($ch, CURLOPT_HEADER, True);
    	curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
    	curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, true);
    	curl_setopt($ch, CURLOPT_VERBOSE, True);
    	if (!empty($_POST)) {
    		curl_setopt($ch, CURLOPT_POST, true);
    		curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
    	}
    	curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    	//curl_setopt($ch, CURLOPT_FAILONERROR, true);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    	curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    	$response = curl_exec($ch);
    	$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    	$header = substr($response, 0, $header_size);
    	$output = substr($response, $header_size);
    	if($output === false)
    	{
    	    $output = curl_error($ch);
    	}else {
    		$content = $output;
    	}
    	if (strpos($output, "301 Moved")!==false || strpos($output, "302 Moved")!==false || strpos($output, "Moved Permanently") !== false) {
    		$dom = new DOMDocument();
    		$dom->loadHTML($output);
    		if ($dom->getElementsByTagName("a")->length == 1) {
    			$el =$url = $dom->getElementsByTagName("a")->item(0);
    			if ($el->nodeValue == 'here') {
    				$url = $el->getAttribute("href");
    				GET_CONTENT($url);	
    			}
    		}
    	}
    	curl_close($ch);
    }
    ?>


    Ach ja, die Seite wird trotzdem angezeigt, nur das mit den Cookies funktioniert nicht.
    Ich hoffe ihr könnt mir helfen.
    Jetzt schon mal Danke.

Login zum Webhosting ohne Werbung!