English 中文(简体)
如何探索这一页的产出
原标题:How to explode this page output

http://master.anti3d.com/raw_server_list2.php

该总服务器的文件指出,每一条目都以这种方式分开。

注:LF = LineFeed = 10

Format: serverName[LF]ipAddress:port;users/maxusers;gameCount;version;location[LF]

例:

服务器名称

111.11.1111:27888;0/25;0.86;USA

服务器名称

222.2222:27888;0/50;0.86;加拿大

利用OOCurl图书馆,用面向标的CURL检索现场数据

<?php

include_once( oocurl.php );

$fetchmaster = new Curl( http://master.anti3d.com/raw_server_list2.php );
$data = $fetchmaster->exec();
$parsedata = explode( 
 , $data);
print_r($parsedata);
?>

Curl retrieves the page info but when I try to explode using character or newline, ASCII 10, it just doesn t works. I downloaded the page output and saw it with an hex editor and it s using x0a, , linefeed

我做了什么错误?

最佳回答

更改单一报价

$parsedata = explode( 
 , $data);

a. 适当编码新线的两字。

$parsedata = explode("
", $data);

例如:

print  
 ; // prints a backslash, followed by the letter n
print "
"; // prints a newline

PHP Manual:

Note: Unlike the two other syntaxes, variables and escape sequences for special characters will not be expanded when they occur in single quoted strings.

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签