PHP CURL: HTTP üstbilgileri Komple manipülasyon izin verilmiyor?

0 Cevap php

Ben otomatik olarak benim okulun ağına beni günlükleri bir senaryo yazmaya çalışıyorum, çek içine almak çalışıyorum sınıflar artık tamamen dolu ve bir noktaya kadar açtı varsa, benim için sınıfı kaydeder eğer. Ancak, ben sadece günlük-in sürecinde büyük bir engele isabet ettik.

Basically, I've been looking at the headers that are sent when I log in and try to replicate them. The problem is I keep getting an error saying "HTTP/1.1 400 Bad Request Content-Type: text/html Date: Sat, 23 Oct 2010 18:42:20 GMT Connection: close Content-Length: 42 Bad Request (Invalid Header Name)".

I'm guessing it has something to do with Host parameter I'm setting being different from what it really is (I set it so it is elion.psu.edu, but when looking at the headers from my script it has changed back to grantbachman.com, where the script is hosted). I guess it'll be best just to show you. The beginning of the header I'm trying to create:

https://elion.psu.edu/cgi-bin/elion-student.exe/submit

POST /cgi-bin/elion-student.exe/submit HTTP/1.1
Host: elion.psu.edu

Ben komut dosyası çalıştırdığınızda gösterir başlığının başlangıcı:

http://myDomain.com/myScriptName.php

GET /elionScript.php HTTP/1.1
Host: myDomain.com

Temel olarak, ilk satırı Sunucu adı farklı, farklı, ve ben GET değişkeni yerine POST değişkeni (true CURLOPT_POST ayarlanmış olsa bile) ile benim bilgi yolluyorum diyor. Ben temelde sunucu benim komut kabul gibi bu bilgisinin değiştirilmesi ile herhangi bir yardım arıyorum. Ben fikir taze bitti. Teşekkürler.

Ah işte ben kullanıyorum kodu:

$data = array(
    "$userIDName" => '********',
    "$passName" => '********',
    "$submitName" => 'Login+to+eLion',
    'submitController' => '',
    'forceUnicode' => '%D0%B4%D0%B0',
    'sessionKey' => "$sessionValue",
    'pageKey' => "$pageKeyValue",
    'shopperID' => '');

$contentLength = strlen($userIDName . '=*********&' . $passName . '=********&' . $submitName .'=Login+to+eLion&submitController=&forceUnicode=%D0%B4%D0%B0&sessionKey=' . $sessionValue . '&pageKey=' . $pageKeyValue . '&shopperID=');

$ch = curl_init("https://elion.psu.edu/cgi-bin/elion-student.exe/submit");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIE,'sessionKey="$sessionValue";pageKey="$pageKeyValue";BIGipServerelion_prod_pool="$prodPoolValue"');
curl_setopt($ch,CURLOPT_HTTPHEADER,array(
    'Host: elion.psu.edu',
    'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10',
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language: en-us,en;q=0.5','Accept-Encoding: gzip,deflate',
    'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
    'Keep-Alive: 115',
    'Referer: https://elion.psu.edu/cgi-bin/elion-student.exe/launch/ELionMainGUI/Student',
    "Cookie: sessionKey=$sessionValue; pageKey=$pageKeyValue; BIGipServerelion_prod_pool=$prodPoolValue", 'Content-Type: application/x-www-form-urlencoded',
    "Content-Length: $contentLength"));
$contents2 = curl_exec ($ch);

I't Ayrıca muhtemelen önemli unutmayın ki ben çalıştırdığınızda komut aşağıdaki bilgilerin hiçbiri 'Keep-Alive: 115' Ben başlığı görüntülemek zaman satır görüntülenir.

0 Cevap