CURL & Proxy

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • CURL & Proxy

    Hallo,

    Ich habe gesehen das mann CURL auch über ein Proxy benutzen kann
    allerdings kriege ich das nicht so ganz hin ich krieg entweder eine weiße Seite zurück, bzw den Fehler
    PHP-Code:
    HTTP/1.1 302 Found DateFri27 Jun 2008 01:21:14 GMT ServerApache X-powered-byPHP/5.2.6 

    Location


    http://www.000webhost.com/admin-review

    Content-length0
     Connection
    close Content-typetext/html 

    oder
    PHP-Code:
    500 Internal Server Error
    An internal server error occurred
    Please try again later



    Das Script sieht wie folgt aus:

    PHP-Code:
    $url='http://jamescarter.web44.net/test.php';
    $proxy='198.151.38.68:80';
    $vars='var1=1&var2=text';

      
    $ch=curl_init();
      
    curl_setopt($chCURLOPT_URL$url);
      
    curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
      
    curl_setopt($chCURLOPT_USERAGENT"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
      
    curl_setopt($chCURLOPT_HEADER1);
      
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
      
    curl_setopt($chCURLOPT_TIMEOUT60);
      
    curl_setopt($chCURLOPT_HTTPPROXYTUNNEL1); 
      
    curl_setopt($chCURLOPT_COOKIEFILE"cookiefile");
      
    curl_setopt($chCURLOPT_COOKIEJAR"cookiefile");
      
    curl_setopt($chCURLOPT_PROXY$proxy);
      
    curl_setopt($chCURLOPT_POST1);
      
    curl_setopt($chCURLOPT_POSTFIELDS$vars);
    $result curl_exec($ch); // run the whole process
    echo "$result"
    je nachdem ob ich

    PHP-Code:
    curl_setopt($chCURLOPT_HTTPPROXYTUNNEL1); 
    auf 1 oder 0 stelle
    Zuletzt geändert von JamesCarter; 27.06.2008, 03:36.

  • #2
    Also den Location-Header würde ich jetzt nicht wirklich als Fehler werten. Warst nicht du der jenige, dem das FOLLOW untersagt ist?

    Kommentar


    • #3
      Ist mitlerweile ein anderer Webspace nun müsste es gehen

      Kommentar

      Lädt...
      X