How to get Cookie in request header while curl php - php

I am trying to check login information for a website using curl php.
The Request header looks like this:
GET /loginpage.cgi HTTP/1.1
Host: test.com
Connection: keep-alive
pragma: no-cache
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Accept: */*
Referer: https://test.com/login.cgi
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
Cookie: QSESSIONID=**c0da73be1917324c157e5c45b1bccd4f**
The QSESSIONID value changes every time, I need this value to be passes in the header in order to make a curl request from php. My php code looks like:
<?php
$username = 'user';
$password = 'pass';
$url = "https://test.com/login.cgi?key=GetLoginUserInfo";
$ch = curl_init();
$headers = array();
$headers[] = "Pragma: no-cache";
$headers[] = "Accept-Encoding: gzip, deflate, br";
$headers[] = "Accept-Language: en-US,en;q=0.8";
$headers[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36";
$headers[] = "Accept: */*";
$headers[] = "Referer: https://test.com/login.cgi?key=UDIT";
$headers[] = "Cookie: QSESSIONID=c0da73be1917324c157e5c45b1bccd4f";
$headers[] = "Connection: keep-alive";
$headers[] = "Cache-Control: no-cache, no-store, max-age=0, must-
revalidate";
$headers[] = "Expires: Fri, 01 Jan 1990 00:00:00 GMT";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$result = curl_exec($ch);
print_r($result);
$ch_error = curl_error($ch);
if ($ch_error) {
echo "cURL Error: $ch_error";
} else {
echo $result;
}
curl_close($ch);
?>
Now when I run this. When I get the session id from the dev tools request header and change it in my header then only I can log in, because the value changes every time some one login.
So my question is, is their a way I can get that value from the request header so that i can append that value in my header in php code. Or any other way that you can suggest, I am open for suggestions.
If i remove this information from php code the request fails, if

That looks like a session ID (the name kinda gives it away), these are generated on your first connection. You're supposed to store this and send this as a cookie in subsequent requests so the server can keep track of your session.
If you dont send this cookie header you will get a random one with every request.
This code is written in a way to attempt to teach you how cookies are handled. There are a lot of assumptions about what you are trying to do, but this gives you a basic understanding of how to parse/handle headers and the session ID.
I've avoided using a cookiejar (which is much easier and cleaner to code) because it automatically does all of this for you, i recommend you look into them once you learn how session ID's work.
<?php
class MyService
{
private $headers = [];
private $cookies = [];
private $loggedIn = false;
function login($username, $password)
{
$ch = curl_init('https://test.com/login.cgi');
#Assumption: Do whatever is needed for login here
curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);
# This is where we setup header processing
curl_setopt($ch, CURLOPT_HEADERFUNCTION, [$this, 'parseHeaders']);
#Assumption: Check for valid response
$response = curl_exec($ch);
$this->loggedIn = ($response == 'true');
curl_close($ch);
return $this->loggedIn;
}
function getHeader($header)
{
return array_key_exists($header, $this->headers) ? $this->headers[$header] : null;
}
function getCookie($cookie)
{
return array_key_exists($cookie, $this->cookies) ? $this->cookies[$cookie] : null;
}
function parseHeaders($ch, $header)
{
if (stristr($header, 'set-cookie')) {
# If you can install PECL pecl_http this will work better
// $this->cookies = http_parse_cookie(strstr('Set-Cookie', $header))['cookies'];
# Otherwise
$reserved_words = [
'httponly',
'expire',
'path',
'expires',
'domain',
'secure'
];
preg_match("/Set-Cookie: (.*)/", $header, $cookies);
foreach ($cookies as $cookie) {
$cookie = explode(';', $cookie);
foreach ($cookie as $cookie_part) {
$cookie_part = explode('=', $cookie_part);
array_walk($cookie_part, create_function('&$val', '$val = trim($val);'));
if (!in_array($cookie_part[0], $reserved_words) && isset($cookie_part[1])) {
$this->cookies[$cookie_part[0]] = $cookie_part[1];
}
}
}
} else {
$header_part = explode(':', $header, 2);
if (isset($header_part[1])) {
$this->headers[trim($header_part[0])] = trim($header_part[1]);
}
}
}
function otherInfo()
{
if (!$this->loggedIn) {
throw new NotLoggedInException('Login first');
}
$headers = []; # Populate whatever headers are mandatory
$url = "https://test.com/login.cgi?key=GetOtherInfo";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, 'QSESSIONID=' . $this->getCookie('QSESSIONID'));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function getUserInfo()
{
if (!$this->loggedIn) {
throw new NotLoggedInException('Login first');
}
$headers = []; # Populate whatever headers are mandatory
$url = "https://test.com/login.cgi?key=GetLoginUserInfo";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIE, 'QSESSIONID=' . $this->getCookie('QSESSIONID'));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}
$username = 'user';
$password = 'pass';
$api = new MyService();
$api->login($username, $password);
$info = $api->getUserInfo();
$other = $api->otherInfo();

Related

PHP cUrl Handle resource is replaced by an integer

I'm using PHP curl to send a series of requests to a 3rd party server which requires login and then persisting the session cookie for that login.
So I wrapped the curl operation into this class:
class SoapCli {
private $ch;
private $id;
private $rc;
function __construct() {
$this->rc=0;
$this->id=bin2hex(random_bytes(8));
$this->ch = curl_init();
$time=microtime(true);
error_log(PHP_EOL.PHP_EOL."Instance id $this->id created ($time): \$this->ch = ".print_r($this->ch,true).PHP_EOL,3,"log.txt");
curl_setopt($this->ch, CURLOPT_AUTOREFERER,1);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, "");
curl_setopt($this->ch, CURLOPT_ENCODING, "");
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_VERBOSE, 1);
}
function Request(string $method, string $url, array $headers = array(), $postdata = "", $referer = null) {
$resp = new stdClass();
$resp->id = $this->id;
$this->rc++;
$time=microtime(true);
error_log("Instance id $this->id before request $this->rc ($time): \$this->ch = ".print_r($this->ch,true).PHP_EOL,3,"log.txt");
try {
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
if (isset($referer)) curl_setopt($this->ch, CURLOPT_REFERER, $referer);
if (preg_match("/^POST$/i",$method)===1) curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata);
$resp->body = curl_exec($this->ch);
$resp->err_message = curl_error($this->ch);
$resp->err_number = curl_errno($this->ch);
$resp->info = curl_getinfo($this->ch);
}
catch (Exception $exception) {
$resp->err_message = $exception->getMessage();
$resp->err_number = $exception->getCode();
$resp->info = $exception->getTrace();
}
$time=microtime(true);
error_log("Instance id $this->id before request $this->rc ($time): \$this->ch = ".print_r($this->ch,true).PHP_EOL,3,"log.txt");
return $resp;
}
}
However, after the 3rd request, the protected variable that stored the curl handle resource has its content replaced by the value of 0 (integer) and I really can't figure out why. I could only collect this log:
Instance id 1cb893bc5b7369bd created (1547852391.7976): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 1 (1547852391.8025): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 1 (1547852392.0723): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 2 (1547852392.0778): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 2 (1547852392.357): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 3 (1547852392.3616): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 3 (1547852392.6225): $this->ch = Resource id #3
Instance id 1cb893bc5b7369bd before request 4 (1547852393.0264): $this->ch = 0
Instance id 1cb893bc5b7369bd before request 4 (1547852393.0758): $this->ch = 0
Instance id 1cb893bc5b7369bd before request 5 (1547852394.8992): $this->ch = 0
Instance id 1cb893bc5b7369bd before request 5 (1547852394.9461): $this->ch = 0
EDIT: This is the code that consumes class SoapCli:
// index.php
$postdata = filter_input_array(INPUT_POST);
if ($_SESSION["logged_in"]===true) {
echo file_get_contents("main.html");
} else if (isset($postdata) && isset($postdata["action"])) {
$action = $postdata["action"];
if ($action==="Login" && isset($postdata["usrcpf"]) && isset($postdata["usrpwd"])) {
$username=$postdata["username"];
$password=$postdata["password"];
$sc=new SoapCli(); //instantiated here
$_SESSION["sc"]=$sc;
$login_response = $sc->Request(
"GET",
BASEURL."/login",
array(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection: keep-alive",
"Upgrade-Insecure-Requests: 1",
"Cache-Control: max-age=0"
)
);
if ($login_response->err_number) {
echo file_get_contents("login_server_error.html");
} else {
$dom = new DOMDocument;
$dom->loadHTML($login_response->body);
$xdom = new DOMXPath($dom);
$csrf_token_nodes = $xdom->query("//input[#name='_csrf_token']/#value");
if ($csrf_token_nodes->length<1) {
echo file_get_contents("login_server_error.html");
} else {
$csrf_token = $csrf_token_nodes->item(0)->textContent;
$postdata = "_csrf_token=$csrf_token&_username=$username&_password=$password&_submit=Login";
$login_check_response = $sc->Request(
"POST",
BASEURL."/login_check",
array(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3",
"Content-Type: application/x-www-form-urlencoded",
"Connection: keep-alive",
"Upgrade-Insecure-Requests: 1"
),
$postdata,
BASEURL."/login"
);
if ($login_check_response->err_number) {
echo file_get_contents("login_server_error.html");
} elseif (strpos($login_check_response->body, "api.js")) {
echo file_get_contents("login_auth_error.html");
} else {
$route_userinfo = $sc->Request(
"POST",
BASEURL."/route",
array(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0",
"Accept: */*",
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3",
"Content-Type: application/json",
"X-Requested-With: XMLHttpRequest",
"Connection: keep-alive",
"Upgrade-Insecure-Requests: 1",
),
USERINFO_JSON,
BASEURL."/"
);
if ($route_userinfo->err_number) {
echo file_get_contents("login_server_error.html");
} else {
$_SESSION["logged_in"]=true;
$_SESSION["user_info"]=json_decode($route_userinfo->body);
header("Location: ".$_SERVER["PHP_SELF"], true, 303);
}
}
}
}
} else {
http_response_code(400);
}
} else {
echo file_get_contents("login.html");
}
and
// ajax.php (called by JS in main.html, which is loaded after login)
if ($_SESSION["logged_in"]===true) {
$postdata = filter_input_array(INPUT_POST);
if (isset($postdata)) {
if (isset($postdata["content"])) {
if ($postdata["content"]==="tasks") {
$sc=$_SESSION["sc"];
$route_tasks = $sc->Request(
"POST",
BASEURL."/route",
array(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0",
"Accept: */*",
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3",
"Content-Type: application/json",
"X-Requested-With: XMLHttpRequest",
"Connection: keep-alive",
"Upgrade-Insecure-Requests: 1",
),
TAKS_JSON,
BASEURL."/"
);
if ($route_tasks->err_number) {
echo file_get_contents("ajax_server_error.html");
} else {
$tarefas=json_decode($route_tasks->body);
if (isset($tarefas) && is_array($tarefas->records)) {
foreach($tarefas->records as $i=>$tarefa){
echo "<p>".$tarefa->especieTarefa->nome."</p>";
}
} else {
http_response_code(500);
}
}
}
} else {
http_response_code(400);
}
} else {
http_response_code(400);
}
} else {
http_response_code(403);
}
Since the variable SoapCli::ch is not accessible out of the class, I really can't see how its content could be changed without a statement. I coundn't find any information about a kind of http request/response which would destroy the handle, either.
Additional info
Whatever it is, it doesn't have to do with the request, because i tried to repeat request #3, which is valid and receives a valid response, and its repetition fails because of the handle is gone.
Plus, what I'm trying to implement in PHP is already done by a fully functional .NET desktop (winforms) application, so it's not like it can't be done for external reasons. I'm just trying to do with PHP curl what I did with System.Net.HttpWebRequest, and stumbled upon the problem described at this post.
How can I preserve the handle as long as I need it?
I'm using PHP 7.2 on IIS Express/Windows 10.
Short answer is: the handle does not exist when you are trying to use it inside ajax.php
Inside ajax.php, take a look at the following line:
$sc=$_SESSION["sc"];
And then you call:
$route_tasks = $sc->Request(
...
);
So you instaciated your class inside index.php and all the 3 calls made there where succesfull, then you write an object into the $_SESSION["sc"] variable and apparently the object gets encoded and decoded correctly by php's session handler which is why you are still able to call the method Request inside ajax.php after retrieving the object.
While you are indeed using an object in ajax.php it is not the same instance of the object that was created by index.php as that instance belongs to the index.php thread along with the curl handle; calling ajax.php from index.php will create a diffrent thread to handle it and will require a new curl handle as well.
Change $sc=$_SESSION["sc"]; to $sc=new SoapCli(); so the curl handle can be created before used.
I'm posting this answer just to show how I went around the problem that was described and explained by #Solrac in his answer (which is correct and I'll accept):
class SoapCli {
private $ch;
private $cookiepot;
function __construct() {
$this->cookiepot=tempnam(sys_get_temp_dir(),"CookieJar");
$this->reconstruct();
}
function reconstruct() {
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_AUTOREFERER, true);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 300);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookiepot);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookiepot);
curl_setopt($this->ch, CURLOPT_ENCODING, "");
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->ch, CURLOPT_HEADER, true);
curl_setopt($this->ch, CURLINFO_HEADER_OUT, true);
curl_setopt($this->ch, CURLOPT_MAXREDIRS, 32);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_VERBOSE, true);
}
function Request(string $method, string $url, array $headers = array(), $postdata = "", $referer = "") {
if (!is_resource($this->ch)) {
$this->reconstruct();
}
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_REFERER, $referer);
if (preg_match("/^POST$/i",$method)===1) curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata);
$response=curl_exec($this->ch);
list($headers,$body)=preg_split("/\r\n\r\n(?!HTTP)/", $response, 2);
$resp_obj = (object) array(
"body"=>$body,
"headers"=>$headers,
"err_number"=>curl_errno($this->ch),
"err_message"=>curl_error($this->ch),
"info"=>curl_getinfo($this->ch)
);
return $resp_obj;
}
function log(string $text) {
file_put_contents($this->id."log.txt",$text.PHP_EOL,FILE_APPEND|FILE_TEXT|LOCK_EX);
}
}

PHP - Loop cURL with increase id of URL

with the following code a name with an ID (each name in the gnd can be addressed by an ID) is received via the GND interface. This works.
Now i want to get many names at the same time with a cURL loop. The ID of the URL must always be increased by one and the cURL request must loop. How can I do this?
With this Code i receive for example names from the GND database
<?php
header('Content-type: text/html; charset=utf-8');
$User_Agent = 'Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0';
$url = "http://hub.culturegraph.org/entityfacts/118600001";
$request_headers = [];
$request_headers[] = 'Accept: application/json';
$request_headers[] = 'charset=utf-8';
$request_headers[] = 'Content-Type: application/json; charset=utf-8';
$request_headers[] = 'Accept-Encoding: gzip, deflate, identity';
$request_headers[] = 'Accept-Language: de,en-US;q=0.7,en;q=0.3';
for ($i = 1; $i <= 10; $i++)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $User_Agent);
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, "");
$result = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
}
curl_close($ch);
$data = json_decode($result, true);
if ($code == 200) {
$data = json_decode($result, true);
echo 'Erfolg';
} else {
$error = $data['Error'];
echo 'Beim anfordern der GND-Daten ist ein Fehler aufgetreten: Fehlercode ' . $error;
echo ' Zurueck<br />';
}
var_dump($data['preferredName']);
Result for URL with ID 118600001 = Gerhardt von Reutern
But how must the code be adapted, so that also the names of the URL's 118600002, 118600003 and so on are output? So as often as it is specified. Be it 100 or 1000 times.
change your $url variable to something like $base_url which is the url without the ID
$base_url = "http://hub.culturegraph.org/entityfacts/";
Then in your for loop you do:
$ch = curl_init($base_url . (118600001 + $i));
this rule can be removed, this is not necessary:
curl_setopt($ch, CURLOPT_URL, $url);
You should also handle the response inside the for loop, else you will only see the last person's name, after an incredibly long load time.

Misspelled RegEx in PHP function preg_match()

This is a question about PHP, cURL, preg_match(), RegEx, and Instagram.
I'm trying to write a cURL PHP code that logs-in to Instagram, and then access content only available to a validated (logged-in) user. In this question there's an interesting code just for that.
I copy-pasted the code, which is the following:
<?php
$username = "yourname";
$password = "yourpass";
$useragent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/50.0.2661.102 Chrome/50.0.2661.102 Safari/537.36";
$cookie=$username.".txt";
#unlink(dirname(__FILE__)."/".$cookie);
$url="https://www.instagram.com/accounts/login/?force_classic_login";
$ch = curl_init();
$arrSetHeaders = array(
"User-Agent: $useragent",
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: en-US,en;q=0.5',
'Accept-Encoding: deflate, br',
'Connection: keep-alive',
'cache-control: max-age=0',
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $arrSetHeaders);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__)."/".$cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__)."/".$cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$page = curl_exec($ch);
curl_close($ch);
// try to find the actual login form
if (!preg_match('/<form method="POST" id="login-form" class="adjacent".*?<\/form>/is', $page, $form)) {
die('Failed to find log in form!');
}
$form = $form[0];
// find the action of the login form
if (!preg_match('/action="([^"]+)"/i', $form, $action)) {
die('Failed to find login form url');
}
$url2 = $action[1]; // this is our new post url
// find all hidden fields which we need to send with our login, this includes security tokens
$count = preg_match_all('/<input type="hidden"\s*name="([^"]*)"\s*value="([^"]*)"/i', $form, $hiddenFields);
$postFields = array();
// turn the hidden fields into an array
for ($i = 0; $i < $count; ++$i) {
$postFields[$hiddenFields[1][$i]] = $hiddenFields[2][$i];
}
// add our login values
$postFields['username'] = $username;
$postFields['password'] = $password;
$post = '';
// convert to string, this won't work as an array, form will not accept multipart/form-data, only application/x-www-form-urlencoded
foreach($postFields as $key => $value) {
$post .= $key . '=' . urlencode($value) . '&';
}
$post = substr($post, 0, -1);
preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $page, $matches);
$cookieFileContent = '';
foreach($matches[1] as $item)
{
$cookieFileContent .= "$item; ";
}
$cookieFileContent = rtrim($cookieFileContent, '; ');
$cookieFileContent = str_replace('sessionid=; ', '', $cookieFileContent);
$oldContent = file_get_contents(dirname(__FILE__)."/".$cookie);
$oldContArr = explode("\n", $oldContent);
if(count($oldContArr))
{
foreach($oldContArr as $k => $line)
{
if(strstr($line, '# '))
{
unset($oldContArr[$k]);
}
}
$newContent = implode("\n", $oldContArr);
$newContent = trim($newContent, "\n");
file_put_contents(
dirname(__FILE__)."/".$cookie,
$newContent
);
}
$arrSetHeaders = array(
'origin: https://www.instagram.com',
'authority: www.instagram.com',
'upgrade-insecure-requests: 1',
'Host: www.instagram.com',
"User-Agent: $useragent",
'content-type: application/x-www-form-urlencoded',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: en-US,en;q=0.5',
'Accept-Encoding: deflate, br',
"Referer: $url",
"Cookie: $cookieFileContent",
'Connection: keep-alive',
'cache-control: max-age=0',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__)."/".$cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__)."/".$cookie);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $arrSetHeaders);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
sleep(5);
$page = curl_exec($ch);
preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $page, $matches);
$cookies = array();
foreach($matches[1] as $item) {
parse_str($item, $cookie1);
$cookies = array_merge($cookies, $cookie1);
}
var_dump($page);
curl_close($ch);
?>
You must, of course, change the $username's value from yourname to an actual username, and $password's value from yourpass to the corresponding password of the username. Also, I don't think this code will work if 2-step authentication is enabled in the account of the user (ie., for example, a MMS is sent to the linked phone number, or an email is sent to the linked email), therefore, 2-step authentication must be disabled in the user's account settings.
However, when I run this PHP script in Chrome, I get the message Failed to find log in form!, meaning that, on line 35, the pattern (written as a RegEx) /<form method="POST" id="login-form" class="adjacent".*?<\/form>/is wasn't found in the variable $page, which at the same time is basically the HTML of the classic Instagram login page.
It's weird that such pattern is not being found, because there's indeed a HTML named <form method="POST" id="login-form" class="adjacent" (to check it yourself, go to the login page, press Ctrl+U, then Ctrl+F, and then paste the previous pattern). So, I assume this is because the RegEx is somehow misspelled. Is that correct?
Even weirder, I tested it on the page RegEx101.com, and the test was successful. So, why is PHP saying the pattern wasn't found?
The idea is that the pattern can be found in the code of the original question, so that I can log-in automatically/programmatically. Keep in mind that more preg_match() functions are used later in the code, eg. on lines 42, 48 (preg_match_all()), 70 (preg_match_all()), and 137 (preg_match_all()).
EDIT: I realized that if I add var_dump($page); just before line 35, I get bool(false) (in other words, the HTML output is bool(false) Failed to find log in form!). I think this is the reason why the code returns the message Failed to find log in form!. However, why is the value of $page returning that?

How to generate Facebook User Access Token using curl

I am doing a project where I need to import Facebook Page feeds. For accessing Facebook page feeds, I need a page_access_token and to generate page_access_token I need User access token.
Here my question is
1.How to generate this User_access_token using CURL ? Most of the solution requires APP_KEY & APP_SECRET. Is it not possible to get user_access_token without any APP ?
Once I get the User_access_token how do I use it to get Page access Token using CURL.
You can´t get ANY Token without an App, but you don´t need to program anything in order to get a User Token. These articles explain everything in detail:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
https://developers.facebook.com/docs/facebook-login/
For example, you can use the API Explorer to select your App and generate User Tokens.
Wrong question, No tokens are needed
I just tried it and it took me less than 5 minutes, never having scraped FB in the past. I saved the page to my Server and brought up the page using my URL and it looked just like if I were on FB.
If a Browser can load the page with JavaScript disabled, then you can too.
You have to use https://m.facebook.com/, JavaScript is not required on their mobile site.
What you want to do, is not difficult at all.
Just go there in your Browser and copy the cookies key values into the Cookie: HTTP request header. Mine are x'ed out.
<?php
$request = array();
$request[] = 'Host: m.facebook.com';
$request[] = 'User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:39.0) Gecko/20100101 Firefox/39.0';
$request[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
$request[] = 'Accept-Language: en-US,en;q=0.5';
$request[] = 'Accept-Encoding: gzip, deflate';
$request[] = 'DNT: 1';
$request[] = 'Cookie: datr=x; fr=x; lu=x s=xx; csm=x; xs=xx; c_user=x; p=-2; act=x; presence=x; noscript=1';
$request[] = 'Connection: keep-alive';
$request[] = 'Pragma: no-cache';
$request[] = 'ache-Control: no-cache';
$url = 'https://m.facebook.com/';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_ENCODING,"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_FILETIME, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,100);
curl_setopt($ch, CURLOPT_FAILONERROR,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $request);
$data = curl_exec($ch);
if (curl_errno($ch)){
$data .= 'Retreive Base Page Error: ' . curl_error($ch);
}
else {
$skip = intval(curl_getinfo($ch, CURLINFO_HEADER_SIZE));
$responseHeader = substr($data,0,$skip);
$data= substr($data,$skip);
$info = curl_getinfo($ch);
$info = var_export($info,true);
}
while(true){ // get cookies from response header
$s = strpos($head,'Set-Cookie: ',$e);
if (!$s){break;}
$s += 12;
$e = strpos($head,';',$s);
$cookie = substr($head,$s,$e-$s) ;
$s = strpos($cookie,'=');
$key = substr($cookie,0,$s);
$value = substr($cookie,$s);
$cookies[$key] = $value;
}
$cookie = ''; // format cookies for next request header
$show = '';
$head = '';
$delim = '';
foreach ($cookies as $k => $v){
$cookie .= "$delim$k$v";
$delim = '; ';
}
$fp = fopen("fb.html",'w');
fwrite($fp,"$data\n$info\n$responseHeader");
fclose($fp);
readfile('fb.html');

Submitting to ASP.NET Form from PHP parameters match yet final step fails quietly

With the approval of the receiving company yet without their help, I am logging into an ASP.Net website, getting the authentication cookie, letting it 302 me to a landing page, posting again to the form I need, capturing the viewstate and eventvalidation. I am then posting back to form with parameter order, name and values matching what is sent from the browser when I capture the browser's post.
I am not receiving any hard errors such as invalid viewstate or failed validation, but the response is always a successful page load with content of "There was a problem with your request please call".
I have attached my code, my final page header and form parameter fields, as well as the parameter fields sent by the browser.
I assume at this point I have a stupid oversight. Please enlighten me to my mistake.
MY CODE:
<?php
$ch = login();
function login() {
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_VERBOSE, 1);
curl_setopt($ch2, CURLOPT_HEADER, 1);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch2, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch2, CURLOPT_MAXREDIRS, 6);
curl_setopt($ch2, CURLOPT_URL, 'https://xxxxxxxxx/Login.aspx?ReturnUrl=%2fRateQuote%2fRateQuote.aspx'); //login URL
curl_setopt($ch2, CURLOPT_POST, 1);
$postData = "";
$fields = array("__EVENTTARGET" => urlencode(""),
"__EVENTARGUMENT" => urlencode(""),
"__VIEWSTATE" => "%2FwEPDwULLTE2MjUwMTMwOTYPZBYCZg9kFgICAw9kFgICAw9kFgICCQ9kFgICCw8QZGQWAWZkZDTilo90KfqDVncPiMLvTixeruyf",
"__EVENTVALIDATION" => "%2FwEWBAKQ%2FLzIAwL8vovzAgLxp5vLAgLXx47%2BBrHxm0MPEe%2Bg03BKXzVK0qjezW8n",
"ctl00%24MainContentPlaceHolder%24txtUserID" => "xxxxxxxx",
"ctl00%24MainContentPlaceHolder%24txtPassword" => "xxxxxxx",
"ctl00%24MainContentPlaceHolder%24btLogin" => "Login");
foreach ($fields as $key => $value) {
$postData .= $key . '=' . $value . '&';
}
rtrim($postData, '&');
curl_setopt($ch2, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch2, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch2, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
print("*** PRE EXEC OF LOGIN ***\n\n");
$store = curl_exec($ch2);
//print("** Cleaning Login Cookie**\n");xxxxxxxxx
//cleanCookie("cookie.txt", "cookie.txt");
// PostBack for initial forward
curl_setopt($ch2, CURLOPT_URL, "https://xxxxxxxxx/Default.aspx");
curl_setopt($ch2, CURLOPT_AUTOREFERER, 1);
$inform = curl_getinfo($ch2);
print("*** Postback info for re-direct page:\n \n\n***REDIRECT POST***\n");
$output = curl_exec($ch2);
//cleanCookie("cookie.txt", "cookie.txt");
print("** RETURN FROM REDIRECT POST **\n\n");
// PostBack to get rate form
curl_setopt($ch2, CURLOPT_URL, "https://xxxxxxxxx/RateQuote/RateQuote.aspx");
$inform = curl_getinfo($ch2);
print("*** PostBack to get the form:\n{ $inform}\n\n***GETRATE FORM POST***\n");
$result = curl_exec($ch2);
//cleanCookie("cookie.txt", "cookie.txt");
print("** RETURN FROM GETRATE FORM POST **\n\n");
$token = "__EVENTVALIDATION";
$result1 = strstr($result, $token);
$result2 = substr($result1, strlen($token));
$endpos = strpos($result2, '" />');
$validation = substr($result2, 32, $endpos-32);
$token = "__VIEWSTATE";
$result = strstr($result, $token);
$result = substr($result, strlen($token));
$endpos = strpos($result, '" />');
$state = substr($result, 26, $endpos-26);
$fields = array("__EVENTTARGET" => urlencode(""),
"__EVENTARGUMENT" => urlencode(""),
"__VIEWSTATE" => urlEncode($state),
"__EVENTVALIDATION" => urlencode($validation),
"ctl00%24MainContentPlaceHolder%24dlCustomerType" => "1",
"ctl00%24MainContentPlaceHolder%24usr_PickupDate" => "1%2F18%2F2012",
"ctl00%24MainContentPlaceHolder%24txtOrigin" => "18045",
"ctl00%24MainContentPlaceHolder%24txtDestination" => "18073",
"ctl00%24MainContentPlaceHolder%24txtNumOfPallets" => "5",
"ctl00%24MainContentPlaceHolder%24txtWeight1" => "555",
"ctl00%24MainContentPlaceHolder%24rdQuestion" => "No",
"ctl00%24MainContentPlaceHolder%24Button1" => "Get+Rate",
"ctl00%24MainContentPlaceHolder%24txtJavaScriptReturn" => "",
"ctl00%24MainContentPlaceHolder%24txtSubmit" => "0");
foreach ($fields as $key => $value) {
$postData .= urlencode($key) . '=' . $value . '&';
//print("{$key} = {$value}\n\n");
}
rtrim($postData, '&');
curl_setopt($ch2, CURLOPT_POST, count($fields));
curl_setopt($ch2, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch2, CURLOPT_URL, 'https://xxxxxxxxx/RateQuote/RateQuote.aspx');
curl_setopt($ch2, CURLOPT_AUTOREFERER, 0);
curl_setopt($ch2, CURLOPT_REFERER, 'https://xxxxxxxxx/RateQuote/RateQuote.aspx');
curl_setopt($ch2, CURLINFO_HEADER_OUT, 1);
// PostBack to submit request form
$inform = curl_getinfo($ch2);
print("*** FORM SUBMISSION INFO:\n {$inform} ***\n***Form Submission***\n");
$output = curl_exec($ch2);
//print($output);
print_r( $inform );
//print("\n\n|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\n{$output}");
return $ch2;
}
// Used to remove the HttpOnly tag on one of the cookies to make the environment match firefox. I noticed when the cookie is created by browsing through FireFox it doesn't prepend HttpOnly, however it appears it has no effect on the result.
function cleanCookie($cookieIn, $cookieOut) {
$content = "";
$file = fopen($cookieIn, "r") or die("Cannot open");
while (!feof($file)) {
$temp = fgets($file, 4096);
print("Cookie Cleaning:{ $temp}");
if (strstr($temp, '#HttpOnly_')) {
$content .= substr($temp, 10);
} else {
$content .= $temp;
}
}
fclose($file);
$file = fopen($cookieOut, "w") or die("Cannot open for writing");
fwrite($file, $content);
fclose($file);
}
?>
FINAL FORM FIELDS SENT:
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0.1) Gecko/20100101 --Firefox/9.0.1
Host: xxxxxxxxx
Accept: */*
Cookie: ASP.NET_SessionId=2g2s5e45ovhwfzv4s4didc55; -CTIWEBAPP.ASPXAUTH=724EB6D860199350B4D781D71352B7206E086CEDA9424843C0521C91B2C8A3CA22AA77B181263C3A1F67D7F41E75203CE130F6EC18E18804B68D3DA4C8FB435547585B917D24F9D364966C3D24637A6BE90F49ED1A7B906603A2B6C789A5CDED742F4D0AA4D1F89070236569CA1E4ECDDC261D705AB2985CBB92799C87809477C7E9746B1D841630D1588F8BDAFCA75DDC740E8D0BC3B43DC31A4EA0E283F148C581C688AFB9212AC7A35B68CA0740B18FFC15FAFEC4D8B8E4C501102827AEFBA849C8E82C0E6E6CDEF2B45E118112368BF491987FA1D5CA463067AA00BF857BCF65545B76E571DDB84C1685BA4DDA33BA78E3C6A180CCBBB62E92BCCB4EAB17296C007C
HTTP/1.1 200 OK
Date: Mon, 30 Jan 2012 16:25:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 74804
__EVENTTARGET =
__EVENTARGUMENT =
__VIEWSTATE = %2FwEPDwULLTE5NjI5ODE5NjQPFgQeEUlzQWdncmVnYXRlUGFsbGV0aB4IaXNQYWxsZXRnFgJmD2QWAgIDD2QWBgIDDw8WAh4EVGV4dAUabGl6QHJlY3ljbGluZ2VxdWlwbWVudC5jb21kZAIFDw8WAh8CBRhSRUNZQ0xJTkcgRVFVSVBNRU5UIENPUlBkZAIGD2QWVgIJDw8WAh8CBQpSYXRlIFF1b3RlZGQCCw8QD2QWAh4Ib25DaGFuZ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Holder%24txtOrigin = 07073
ctl00%24MainContentPlaceHolder%24txtDestination = 18045
ctl00%24MainContentPlaceHolder%24txtNumOfPallets = 2
ctl00%24MainContentPlaceHolder%24txtWeight1 = 555
ctl00%24MainContentPlaceHolder%24rdQuestion = No
ctl00%24MainContentPlaceHolder%24Button1 = Get+Rate
ctl00%24MainContentPlaceHolder%24txtJavaScriptReturn =
ctl00%24MainContentPlaceHolder%24txtSubmit = 0
BROWSER FIELDS SENT TO FINAL FORM:
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
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
Connection: keep-alive
Referer: https://xxxxxxxxxx/RateQuote/RateQuote.aspx
Cookie: ASP.NET_SessionId=epgaiu453kcc3p550tzvnf3k; CTIWEBAPP.ASPXAUTH=8924C9AA7B808126939D6C32489EB282988FAD19EB1C4C2C52C0C3121C3EC49B2F4DB90D7C574732BE12F6024A972EE95E241E4188D3380B3BB41D6FFCDEFDAA337CD42DFB8FD04A3946802216CF7AB5EB10E23010829875F20E6035F5CC6B9835880D8FA4B12A24B5133EC7555CBE336671F87CE8026699CB388A0C47A41D43F1F7A44040AAEFEFB9D409AD0482857853652097D3E1ECD9A975E0BAB18FB3501138B65DF1383C4D0A71ECAA68FAA29225A1426D88091A5967473133E876999B1BED0C57C47F2C86F2ED65D4C6AFC111CBFE98E1232A66E00798AE50128892E3F24665F6E0239FB10AD9F7A1CE46A87DA1E56772753CC10A43F5757166120631175359A5; count=21
Browser Based Post Parameters:::
__EVENTTARGET
__EVENTARGUMENT
__VIEWSTATE = %2FwEPDwULLTE5NjI5ODE5NjQPFgQeEUlzQWdncmVnYXRlUGFsbGV0aB4IaXNQYWxsZXRnFgJmD2QWAgIDD2QWBgIDDw8WAh4EVGV4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Tlh5MPAseJrcUIAte4v88IAqOdoJIIdCi6yWCQLLt3%2Fg35vyny%2Bw79TGQ%3D
ctl00%24MainContentPlaceHolder%24dlCustomerType = 1
ctl00%24MainContentPlaceHolder%24usr_PickupDate = 1%2F30%2F2012
ctl00%24MainContentPlaceHolder%24txtOrigin = 07073
ctl00%24MainContentPlaceHolder%24txtDestination = 18045
ctl00%24MainContentPlaceHolder%24txtNumOfPallets= 2
ctl00%24MainContentPlaceHolder%24txtWeight1 = 555
ctl00%24MainContentPlaceHolder%24rdQuestion = No
ctl00%24MainContentPlaceHolder%24Button1 = Get+Rate
ctl00%24MainContentPlaceHolder%24txtJavaScriptReturn =
ctl00%24MainContentPlaceHolder%24txtSubmit = 0

Categories