php


PHP cURL code 0


Im trying login on https://aulavirtual.cibertec.edu.pe/login/index.php
using cURL but i don't know why the page not connect
POST /login/index.php
https://aulavirtual.cibertec.edu.pe/login/index.php
POST /login/index.php HTTP/1.1
Host: aulavirtual.cibertec.edu.pe
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
Referer: https://aulavirtual.cibertec.edu.pe/login/index.php
Cookie: _ga=GA1.3.1291902196.1486689850; _gid=GA1.3.1884694914.1494915834; __tawkuuid=e::aulavirtual.cibertec.edu.pe::wHiJvh0Cg3hTYj3QKz4f6K4WbyFXkEFWMX73qSOlRjJpYoj8t9I9iARBVxBQRnfR::2; Tawk_58a31b6a1919dc09f9ef8f17=vs32.tawk.to::0; MOODLEID1_=%2513%25DFs%25B6%2598%25115%25E5q%259A; MoodleSession=i9jjkvopj6oiobuuk3fet305f6
Connection: keep-alive
Upgrade-Insecure-Requests: 1
username=strusername&password=strpassword: undefined
HTTP/1.1 303 See Other
Date: Tue, 16 May 2017 06:25:26 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.4.45
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: MoodleSession=nqovre7ii6c3m0f6gujlavcl16; path=/
Set-Cookie: MOODLEID1_=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
Location: https://aulavirtual.cibertec.edu.pe/login/index.php?testsession=20799
Content-Language: es
Content-Length: 510
Keep-Alive: timeout=2, max=1000
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
GET /login/index.php?testsession=20799
https://aulavirtual.cibertec.edu.pe/login/index.php?testsession=20799
GET /login/index.php?testsession=20799 HTTP/1.1
Host: aulavirtual.cibertec.edu.pe
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://aulavirtual.cibertec.edu.pe/login/index.php
Cookie: _ga=GA1.3.1291902196.1486689850; _gid=GA1.3.1884694914.1494915834; __tawkuuid=e::aulavirtual.cibertec.edu.pe::wHiJvh0Cg3hTYj3QKz4f6K4WbyFXkEFWMX73qSOlRjJpYoj8t9I9iARBVxBQRnfR::2; Tawk_58a31b6a1919dc09f9ef8f17=vs32.tawk.to::0; MoodleSession=nqovre7ii6c3m0f6gujlavcl16
Connection: keep-alive
Upgrade-Insecure-Requests: 1
HTTP/1.1 303 See Other
Date: Tue, 16 May 2017 06:25:26 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.4.45
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: https://aulavirtual.cibertec.edu.pe/
Content-Language: es
Content-Length: 477
Keep-Alive: timeout=2, max=999
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
login.php
<?php
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$url = 'https://aulavirtual.cibertec.edu.pe/login/index.php';
$post = 'username='.$username.'&password='.$password;
$ch = curl_init();
$agent = $_SERVER["HTTP_USER_AGENT"];
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $username.'&'.$password);
curl_setopt($ch, CURLOPT_COOKIEFILE, $username.'&'.$password);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo 'Code: '.$httpcode.'<br/>';
if ($httpcode == 0) {
echo '<h3>Host not found or not is possible do a connection.</h3>';
} elseif ($httpcode == 200) {
echo '<h3>Login Failed.</h3>';
} elseif ($httpcode == 302) {
echo '<h3>Logeed Successful.</h3>';
} elseif ($httpcode == 408) {
echo "<h3>Request Timeout.</h3>";
} else {
echo 'Please send this error to the Admin.';
}
curl_close($ch);
}
?>
so i get code 0

Related Links

json_encode for more than 2 arrays
Scrape a webpage and get images more than particular width and particular height using php
im getting the value is 1 from database checkbox is not checked php [closed]
Can't password_hash() be easily abused to run a DoS attack due to its long runtime?
Lumen : use config constant file from other folder
Attach generate pdf into mail in Laravel
how to rewrite SEO-friendly url markep in htaccess
ruflin/Elastica - query with multi types, aggregation, filter by column of type
Set font size of table by looking for span which contains table?
Failed loading /usr/lib/php/20151012/xdebug.so Undefined Symbol: zend_sort - PHP 5.6 & Zend Engine 2.6.0
Order products by stock on Magento
access variables so I can display them in a twig file
WordPress Custom Plugin with Ajax, jQuery (Multiple Forms)
Multiselect field in SuiteCRM webtolead form causes warning
How to make users sign in first before accessing your internet connection?
dompdf - Checkbox displayed but it don't displayed checked

Categories

HOME
office365
android-espresso
keyboard
weblogic12c
focus
mousemove
ios-simulator
malware
web2py
azure-data-lake
linker
haxe
capistrano
fedora
angular-meteor
mithril.js
jpa-criteria
hspi
lapack
createjs
feature-extraction
bundler
adminlte
android-custom-view
unity-container
weex
backendless
animated-gif
math.js
unmarshalling
infopath2010
xcrun
sca
sql-execution-plan
des
pdfminer
runtimeexception
jade4j
nanogallery
twilio-php
haar-classifier
nuclio
rm
ilrepack
datediff
webvtt
nslayoutconstraint
mobile-angular-ui
swiperefreshlayout
openerp-6
google-shopping-api
svnserve
spring-mongo
xcode8-beta4
wolfram-language
noclassdeffounderror
simian
frame-grab
urbit
openmrs
certificate-authority
wikimedia-commons
mousehover
astropy
fanotify
asp.net-web-api-helppages
css-paged-media
fantom
ngcordova
roxygen2
modern.ie
mathematical-expressions
signed
tidyr
mojo
sunos
fasterxml
n-tier-architecture
igor
mobile-country-code
oracle-adf-mobile
accessory
jini
map
typesafe-stack
meteorite
discovery
xsd2code
codahale-metrics
quickgraph
insertion
voice-recording
prefuse
trialware
monocross
infopath-2007
drawimage
snackjs
ognl
raw-data
iphone-sdk-4.3
resharper-5.0
motif
activex-exe

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App