Android WebView detection in PHP

I've done a simple Android App with native menu and a webview with my site content. I need to detect if my website is included in a webview in order to hide the menu bar. After a long research I found this way: if($_SERVER['HTTP_X_REQUESTED_WITH'] == "myAppPackage"){ //the site is included in webview } This solution is good for a lot of devices, but for a Galaxy S4 Mini(Android 4.2.2

PHP中的Android WebView检测

我已经完成了一个简单的Android应用程序与本地菜单和web视图与我的网站内容。 我需要检测我的网站是否包含在webview中以隐藏菜单栏。 经过长时间的研究,我发现了这种方式: if($_SERVER['HTTP_X_REQUESTED_WITH'] == "myAppPackage"){ //the site is included in webview } 此解决方案适用于很多设备,但对于Galaxy S4 Mini(Android 4.2.2),此变量为空白! 其他htp头部变量: PATH / usr / local / bin:/ usr

What is the best way to get the URL of a 404'd file after redirect?

I'm working with a PHP site that needs to log errors to a database. As such, I've set up a .htaccess file as follows: ErrorDocument 404 /404.php 404.php contains all of the logging functions necessary to insert the log into the database. What I'm having problems with is retrieving the URL of the file that triggered the 404. Here are the contents of the $_SERVER superglobal arra

重定向后获取404文件的URL的最佳方式是什么?

我正在使用一个需要将错误记录到数据库的PHP站点。 因此,我已经建立了一个.htaccess文件,如下所示: ErrorDocument 404 /404.php 404.php包含将日志插入数据库所需的所有日志记录功能。 我遇到的问题是检索触发404的文件的URL。 以下是$ _SERVER超全局数组的内容: [HTTP_HOST] => {omitted} [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 [HTTP_A

data : file content not posted

Many answers yet on this topic on this website, but none helps me. I am trying to post a file to box (cloud storage). Should be easy but it is not. I use RequestBin to debug. When using curl on commandline, it works great (file is posted to Box) : curl https://requestb.in/1bw1 -H "Authorization: Bearer supersecret" -H "Content-Type: multipart/form-data" -X POST -F file=@/tmp/testfile.pdf

数据:文件内容未发布

在这个网站上关于这个主题的许多答案,但没有人帮助我。 我试图将文件发布到框(云存储)。 应该很容易,但事实并非如此。 我使用RequestBin进行调试。 在命令行中使用curl时,它效果很好(文件发布到Box): curl https://requestb.in/1bw1 -H "Authorization: Bearer supersecret" -H "Content-Type: multipart/form-data" -X POST -F file=@/tmp/testfile.pdf 当试图用php curl执行相同的操作(将文件上传到Box)时

Copy as cURL doesn't submit form in Mac Terminal

I'm trying to submit a form using cURL and I discovered the amazing option in Chrome "copy as cURL". It did work one my own website - I just pasted everything on my Mac Terminal and I received the form. But now I'm trying it on this website: https://www.vigneron-independant.com/contact-vigneron?vigneron=10715 And my Mac terminal seems to just "get" the html code i

复制为cURL不会在Mac Terminal中提交表单

我正在尝试使用cURL提交表单,并且我发现Chrome中的这个惊人选项“copy as cURL”。 它确实在我自己的网站上工作 - 我只在我的Mac Terminal上粘贴了所有内容,并收到了表单。 但现在我在这个网站上试用它:https://www.vigneron-independant.com/contact-vigneron?vigneron=10715 而我的Mac终端似乎只是“获取”html代码而不是提交表单 - 并且我的邮箱中没有发送确认信息,应该有。 任何想法我在这里做错了吗? 我只是在学习c

php curl + post + multipart/form

I am trying to scrap this web site https://www.machinemart.co.uk/, I need to add an product to cart to get certain data. The site uses a post request to add products to cart. URL of the product that i am trying to add: https://www.machinemart.co.uk/p/clarke-amf-panel-for-kc6-and-kc10/ Here an example of the header and body request: Request Headers: Host: www.machinemart.co.uk Agent: Mozilla

PHP curl + post + multipart / form

我试图取消这个网站https://www.machinemart.co.uk/,我需要将产品添加到购物车以获取特定数据。 该网站使用邮寄请求将产品添加到购物车。 我试图添加的产品的URL:https://www.machinemart.co.uk/p/clarke-amf-panel-for-kc6-and-kc10/ 这里是一个头和身体请求的例子: Request Headers: Host: www.machinemart.co.uk Agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 Accept: text/html,app

Fowarding a multipart form data with php and cURL

I'm developing a small proxy in PHP with cURL. It has to receive http requests from a client, make some statistics with this requests, foward the request to the web server and foward the responses to the client. Everything is working fine with GET requests and POST requests with text/html data. I have problem to foward request with multipart/form-data data, in particular i have data both

使用php和cURL支持多部分表单数据

我正在用cURL在PHP中开发一个小代理。 它必须接收来自客户端的http请求,对这些请求进行一些统计,向Web服务器发送请求并提供对客户端的响应。 一切工作正常与GET请求和POST请求与文本/ HTML数据。 我有问题要多部分/表单数据的数据,特别是我有$ _POST和$ _FILES全局变量中的数据。 我应该如何使用这两个变量将请求转发到服务器? 您需要先将文件存储在服务器中,然后使用如下代码: <?php $ch = curl_init();

Microsoft outlook API give 404 error

I try get user contacts through Outlook contacts REST API. I sucessfully got access token, but when i try to get the contacts i get 404 error. This is sended url https://outlook.office.com/api/v1.0/me/contacts?%24select=GivenName%2CSurname%2CEmailAddresses&%24orderby=GivenName&%24top=10 and headers User-Agent: php-tutorial/1.0 Authorization: Bearer ----token here----- Accept: applicatio

微软的Outlook API给404错误

我尝试通过Outlook联系人REST API获取用户联系人。 我成功获得访问令牌,但是当我尝试获取联系人时,我收到404错误。 这是传送的网址 https://outlook.office.com/api/v1.0/me/contacts?%24select=GivenName%2CSurname%2CEmailAddresses&%24orderby=GivenName&%24top=10 和标题 User-Agent: php-tutorial/1.0 Authorization: Bearer ----token here----- Accept: application/json client-request-id: guid here retu

Get data from asp.net page using curl

I tried file_get_content and curl to get page data that shows when I open it in browser but get nothing. URL opens in browser but when I use curl I redirected to home page, what method I use to complete grab page with all data in my response. function curl($url) { $agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0"; $ch = curl_init(

使用curl从asp.net页面获取数据

我试着用file_get_content和curl来获取页面数据,当我在浏览器中打开它时显示,但什么也没有。 URL在浏览器中打开,但是当我使用curl重定向到主页时,我用什么方法来完成抓取页面,并在响应中包含所有数据。 function curl($url) { $agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);

php + curl issue Resource id # 2 on curl

php + curl issue Resource id # 2 on curl_init: $url = "https://example.com:4433/deviceservice/authorize?login=query"; // URL JSON $ch = curl_init($url); echo $ch; //write Resource id # 2 if( $ch ) { curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIF

php + curl问题curl上的资源ID#2

php + curl问题curl_init上的资源ID#2: $url = "https://example.com:4433/deviceservice/authorize?login=query"; // URL JSON $ch = curl_init($url); echo $ch; //write Resource id # 2 if( $ch ) { curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, T

How to load details automatically

Thanks guys and gals got it working //create a function function get_stock_data($symbol){ //set up the url to be called $revenue_url = "http://finance.yahoo.com/q/is?s=".$symbol; //curl call: // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $revenue_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch,

如何自动加载细节

感谢球员和加尔斯让它工作 //创建一个函数function get_stock_data($ symbol){//设置要调用的url $ revenue_url =“http://finance.yahoo.com/q/is?s=".$symbol; // curl call://创建一个新的cURL资源$ ch = curl_init(); //设置URL和其他适当的选项curl_setopt($ ch,CURLOPT_URL,$ revenue_url); curl_setopt($ ch,CURLOPT_HEADER,0); curl_setopt($ ch,CURLOPT_RETURNTRANSFER,1); //抓取URL并