草庐IT

optimizing-content-efficiency

全部标签

php - file_get_contents() 的等效函数?

我想从html页面中解析出一些信息。目前我这样解决问题:header("Content-type:text/plain");$this->pageSource=file_get_contents($this->page);header("Content-type:text/html");$this->page是网站的url。这在XAMPP上运行良好,但是当我将我的脚本上传到我的网络服务器时,我收到以下错误消息:Warning:file_get_contents()[function.file-get-contents]:http://wrapperisdisabledintheserv

PHP file_put_contents 换行

我尝试使用file_put_contents输出新页面。但我在打破新线时遇到了一些麻烦。\r\n';$data.='\r\n';$data.='\r\n';$data.='\r\n';$data.='\r\n';$data.='putsomethinghere\r\n';$data.='\r\n';$data.='\r\n';file_put_contents(dirname(__FILE__).'/new.php',$data);?>我试过\n或者\r\n,都不能换行:1.\r\n\r\n\r\n\r\n\r\nputsomethinghere\r\n\r\n\r\n

php - 在 PHP 中通过 CURL 的 Google Sites API - 获取 "Content is not allowed in prolog."

$curl=newCurl();$data='Email='.urlencode('MYEMAIL@EMAIL.COM').'&Passwd='.urlencode('MYPASSWORD').'&accountType=GOOGLE&source=Google-cURL-Example&service=jotspot';$curl->post('https://www.google.com/accounts/ClientLogin',$data);//matchauthorizationtokenpreg_match("!Auth=(.*)!",$curl->response,$ma

php file_get_contents($url) & 变成 &

我正在尝试像这样向coinbaseapi发出请求$url="https://api.gdax.com/products/BTC-USD/candles?start=".date($format,$starting_date)."&end=".date($format,$ending_date)."&granularity=".$granularity;然后我在file_get_contents($url)中传递它,但它给了我一个错误file_get_contents(https://api.gdax.com/products/BTC-USD/candles?start=2015-05-

php file_get_contents 授权 header

任何人都可以解释为什么这个私有(private)bitbucket存储库的授权功能在我的本地机器上运行(运行PHP5.3.17版)但在我的远程服务器上没有授权(运行PHP5.3.20版)我本身并没有收到错误——我只是收到来自bitbucket的“禁止”响应。但是从我的本地服务器运行一切都很好。functionbitBucketConnect($url){global$bitPassword;global$bitUsername;$context=stream_context_create(array('http'=>array('header'=>"Authorization:Basi

php - file_get_contents 的解析结果 ('php://input' )

我正在使用file_get_contents('php://input')从特定网络服务中检索所有POST参数/值,例如:$postText=file_get_contents('php://input');结果是这样的:inReplyToId=MG1133&to=61477751386&body=test&from=61477751386&messageId=166594397&rateCode=然后我需要获取每个单独的键/值对,因为我需要将它们设置到新数据库记录的字段中。例如,我想结束:$inReplyToId=MG1133$to=61477751386$body=test一旦我知

php - curl -X POST -H 'Content-Type: application/json' -d 到 PHP

我需要发出curl请求,我有这一行“curl-XPOST-H'Content-Type:application/json'-d”并且需要“翻译”为PHPcurl。问题是我不知道“-X”、“-H”和“-d”是什么意思。curl_setopt($ch,CURLOPT_HTTPHEADER,array('Accept:application/json','Content-Type:application/json','Content-Length:'.strlen($itemJson)));我在标题上尝试了类似的东西($itemJson是一个JSON字符串)但是我得到了错误400。我认为我以

php - file_put_contents 路径问题

我想使用php代码形式c:\www\test\script\new\creat_html.php到c:\www\test\html\index.html创建html页面。现在在c:\www\test\script\new\creat_html.php中如何设置路径?我使用dirname(__FILE__),但它只是获取父路径。如何?谢谢。file_put_contents(dirname(__FILE__).'/index.html',$html); 最佳答案 dirname(__FILE__)将返回:c:\www\test\scr

php - file_get_contents 不适用于某些网址

我在PHP中使用file_get_contents。在下面的代码中,第一个URL工作正常,但第二个URL不工作。$URL="http://test6473.blogspot.com";$domain=file_get_contents($URL);print_r($domain);$add_url="http://adfoc.us/1575051";$add_domain=file_get_contents($add_url);echo$add_domain;关于为什么第二个不起作用的任何建议? 最佳答案 file_get_cont

java - 如何在 JSP(java) 中实现 PHP file_get_contents() 函数?

在PHP中,我们可以像这样使用file_get_contents():我如何在Java(JSP)中实现它? 最佳答案 这是我不久前用Java创建的一个函数,它返回文件内容的字符串。希望对您有所帮助。\n和\r可能存在一些问题,但至少应该可以帮助您入门。//ConvertsafiletoastringprivateStringfileToString(Stringfilename)throwsIOException{BufferedReaderreader=newBufferedReader(newFileReader(filenam