response string contains <?php - php

I'm sending a request for an OAuth service:
$headers = array(
'Content-type' => 'application/x-www-form-urlencoded'
);
$request = new cURLRequest();
$request->setMethod(cURLRequest::METHOD_POST);
$request->setHeaders($headers);
//#######TO ADD:
//#######SLUG TEST
$fields = array(
'redirect_uri' => '******custom_cdr/did_conversion/did_conversion/pages/authentication.php',
'response_type' => 'code',
'client_id' => urlencode($config['OAUTH_APP_ID']),
'state' => '0'
);
$request->setBody($fields);
$response = $request->sendRequest($reqUrl);
$respBody = $response->getBody();
if ($response->getStatus() == Response::STATUS_OK) {
eval($respBody);
};
the response is html (persumably authentication) which starts with php container which I don't know how to print / implement.
The code is not redirecting any where:
<?php
$nonce = base64_en
code(mcrypt_create_iv (16, MCRYPT_DEV_URANDOM));
header("Content-Security-Policy: frame-ancestors 'self' *.hubgets.com; script-src 'self' 'nonce-$nonce' 'sha256-uux/wJCjHlmkdiZXIIoFij3+K7FDO0+C0AJ3Yu+OV4w=' 'sha256-NQYHdO+DXSEnKRsq/w9j6GWfOc5gx1XV7TMQO0NAVFA=' 'sha256-Iw8FmsFJDf8FWS5y6AqfZDJiDVU6yqI7sDVnk8uBj6w=' https://tagmanager.google.com https://js.stripe.com https://www.google-analytics.com https://ssl.google-analytics.com https://www.googletagmanager.com https://apis.google.com https://www.googleadservices.com/pagead/;");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<title>Authorize App</title>
<meta name="description" content="Hubgets is a communication and collaboration service that instantly makes your team more collaborative."/>
<meta name="keywords" content="Hubgets, communication, collaboration, telephony, instant messaging, presence, mobility, chat, conference, information management"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-title" content="Hubgets" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="format-detection" content="telephone=no">
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0ea5db">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#0ea5db">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<!-- Browser Favicon -->
<link rel="icon" href="./skin.8aef9f1123badd773f06e869e5cb22a140face8a/favicon.ico" />
<!-- Browser Favicon - Firefox Fix -->
<link rel="icon" href="./skin.8aef9f1123badd773f06e869e5cb22a140face8a/favicon.ico" />
<link rel="stylesheet" type="text/css" href="./skin.8aef9f1123badd773f06e869e5cb22a140face8a/css/hf.css">
it also returns a 404 after trying to find a file located in './' compared to a location I don't have on my server

Related

Why my link in the head tag moved to the body?

I don't understand how this happen.
In my index.php, i require the page header.php :
<?php require("view/viewHeader.php");
Which contains this :
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Mon systeme</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="css/global.css" />
</head>
<body>
<div id="content">
So how i get this on the final page ?
link outside the head
The index.php has 165 lines, so i show you the beginning of the switch where the require call the viewHeader.php :
switch ($action) {
case 'ajout':
$menuTitre = "Ajout";
require("view/viewHeader.php");
require("view/viewMenuEnTete.php");
require("view/viewAjout.php");
require("view/viewFooter.php");
break;
Yes in the source it is alright
<div id="debug">ACTION: string(5) "ajout"
<br/>RECH: NULL
<br/><hr />POST<br/>array(1) {
["action"]=>
string(5) "ajout"
}
<hr /></div><!DOCTYPE html>
<html lang="fr">
<head>
<title>Mon systeme</title>
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="css/global.css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="content">
But the manifest is not detected. I thought there were a problem with the head mixed up.
I get rid of the small div in top, but it doesn't change anything :(
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Mon systeme</title>
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="css/global.css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="content">

dynamically include header.php file that hold js and css resources

I have a question about the inclusion of an header file using PHP.
The code above is the header that I include in all my HTML/PHP view files. I want to save it inside a file called as a naming convention header.php.
My doubt is about the resources loading.
How I can load the needed stylesheets and js files if the header is included from another folder that isn't the same that hold the main css and js folders?
I want to avoid the duplication of the basic resources, and avoid having console errors due to the position of the resources files.
<!DOCTYPE html>
<html lang="it">
<head>
<!-- basic meta tag -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<!-- add facebook og tag here -->
<meta property="og:url" content="" />
<meta property="og:type" content="article" />
<meta property="og:title" content="" />
<meta property="og:description" content="" />
<meta property="og:image" content="" />
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' https://masserianobile.it; font-src 'self' https://fonts.gstatic.com/; img-src 'self'; style-src 'self' https://fonts.googleapis.com/;"> -->
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="css/fontawesome-all.min.css" type="text/css">
<link rel="stylesheet" href="css/app.min.css" type="text/css">
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src=""></script>
</head>
Here is what I use to autoload my PHP classes for any nested directory, this can work for your Front-End resources too:
<?php
/* the root directory of your project
can be useful when working on local env
must not end with a slash, leave it empty if not needed */
const ROOT_PATH = '/projects/some_stuff';
// Get parts of the URL without the root path
$rel_path = explode('/', str_replace(ROOT_PATH, '', $_SERVER['SCRIPT_NAME']));
// Remove empty items from the parts
$rel_path = array_filter($rel_path);
// If the last part is a php file, remove it, we don't need it
if (strpos(end($rel_path), '.php') !== false) { array_pop($rel_path); }
// Build the "../" prefix
$prefix = implode('/', array_fill(0, count($rel_path), '..'));
$prefix = empty($prefix) ? '' : $prefix . '/';
?>
<!-- just output the prefix before the resource URL -->
<link rel="stylesheet" href="<?php echo $prefix; ?>css/bootstrap.min.css" type="text/css">
Documentation:
$_SERVER Server and execution environment information
array_filter() Filters elements of an array using a callback function
end() Set the internal pointer of an array to its last element
array_pop() Pop the element off the end of array
array_fill() Fill an array with values

Link Preview not available

I am developing my personal portfolio . I am facing a problem that is ..
I have placed all the important meta tags in my header.php file and they're visible in the page source code too .. But they are not working . I got to know this when I placed the Meta OG to get the link preview on social sites.
Here's the image of my the website from where I am checking the rich link preview
And here's my website source code image in which you can clearly see the meta tags included
If something isn't clear from the image then here's the link of my website
EDIT : Here's the code of my website's head section
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $baseUrl;
$baseUrl='https://www.iamosama.cf/' ;
?>
<!-- Basic -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>Osama - Web Designer and Developer</title>
<meta name="description" content="Hello , I am Osama . A creative web designer and developer from Karachi , Pakistan" />
<meta name="keywords" content="Web Designer , Web developer , Front end Developer , UI/UX Designer" />
<meta property="og:site_name" content="Osama - The Web Developer" />
<link rel="shortcut icon" href="<?php echo $baseUrl ; ?>images/favicons/favicon.ico" />
<meta property="og:title" content="Personal Portfolio" />
<meta property="og:description" content="Hello , I am Osama . A creative web designer and developer from Karachi , Pakistan " />
<meta property="og:image" content="<?php echo $baseUrl ; ?>images/thumb.jpg" />
<link href="https://fonts.googleapis.com/css?family=Kaushan+Script%7CPoppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- CSS -->
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/basic.css" />
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/layout.css" />
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/blogs.css" />
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/ionicons.css" />
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/magnific-popup.css" />
<link rel="stylesheet" href="<?php echo $baseUrl ; ?>css/animate.css" />
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Favicon -->
<script type="application/ld+json">
{
"#context": "http://schema.org/",
"#type": "Person",
"name": "Osama",
"alternateName": "Muhammad Osama",
"url": "https://www.iamosama.cf/",
"image": "https://www.iamosama.cf/images/profile.jpg",
"sameAs": "https://www.iamosama.cf/",
"jobTitle": "Web Designer and Developer"
}
</script>
</head>

how to set meta tag logic in .ctp file in cakephp?

I try to this code into cakephp code...
<meta charset="utf-8">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
I try this
$this->Html->meta(array('charset'=>'utf-8'));
$this->Html->meta(array('content'=>'IE=edge,chrome=1'), array("http-equiv" => X-UA-Compatible));
$this->Html->meta("viewport", array("content" => width=device-width,initial-sacale=1.0));
$this->Html->meta("description");
$this->Html->meta("author");
but it not working...............
I am a new for cakephp.... so please help me to solve this problem...
try this -
echo $this->Html->meta(
'keywords',//name
'enter any meta keyword here'//content
);
so for this -
<meta name="viewport" content="width=device-width, initial-scale=1.0">
echo $this->Html->meta(
'viewport',//name
'width=device-width, initial-scale=1.0'//content
);
docs for details and other options.
for charset - echo $this->Html->charset('ISO-8859-1');
try -
echo $this->Html->meta(array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0', 'http-equiv' => "X-UA-Compatible"));
<?= $this->Html->meta(
false,
'ie=edge',
['http-equiv' => 'x-ua-compatible']
);
?>
.... resulted
<meta http-equiv="x-ua-compatible" content="ie=edge"/>

Dynamic php og meta tags cant be accessed by facebook?

<html lang="en">
<head>
<?php
$th = $_GET['th'];
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php "/>
<meta property="og:site_name" content="Rapsodia Verano 15'"/>
<meta property="og:description" content="Test"/>
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/<?php print $th; ?> "/>
<title>Rapsodia 2015</title>
</head>
<body>
<img src="http://www.rapsodia.com/ar/img/lookbook/<?php echo $th; ?>">
</body>
</html>
If I enter this:
http://www.rapsodia.com/ar/admin/shares.php?th=09.jpg
at
https://developers.facebook.com/tools/debug/og/object/
I get
<meta property="og:title" content="Test" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php " />
<meta property="og:site_name" content="Rapsodia Verano 15'" />
<meta property="og:description" content="Test" />
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/ " />
for some reason the php variable is not making its way in to the facebook server :(
If I go to http://www.rapsodia.com/ar/admin/shares.php?th=09.jpg
manually everything works just fine :(
How can I make this work? I really dont know what else to try. I really must have dynamic og tags or else I will probably get fired or something.
<html lang="en">
<head>
<?php
$th = $_GET['th'];
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php?th=<?php print $th; ?> "/>
<meta property="og:site_name" content="Rapsodia Verano 15'"/>
<meta property="og:description" content="Test"/>
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/<?php print $th; ?> "/>
<title>Rapsodia 2015</title>
</head>
<body>
<img src="http://www.rapsodia.com/ar/img/lookbook/<?php echo $th; ?>">
</body>
</html>
As WizKid pointed out, I had to also include the parameters in the og:url and it works!

Categories