PHP remote call problem! Hope you can help me learn how to do it! Here is my own!
Create a 123. php file as follows:
$url = "http://www.123456.com/Ajax.ashx?Action=AddOrder&OrderIDShow=1&id=10086&Amt=10&Mb=2&Email=fdhfdf@qq.com"; $result = file_get_contents($url); echo $result;
The result is YES_5e286f3e.
But I want to remove YES _ and display 5e286f3e. what do I need! I have a small dish and hope you can help me solve it!
Reply to discussion (solution)
After you go to the result, if you just want to remove YES _, you can use regular expressions or cut by _ to cut the back.
$str = "YES_5e286f3e";$arr = explode('_',$str);echo $arr[1];
$ Url = "http://www.123456.com/Ajax.ashx? Action = AddOrder & OrderIDShow = 1 & id = 10086 & Amt = 10 & Mb = 2 & Email = fdhfdf@qq.com ";
$ Result = explode ('_', file_get_contents ($ url ));
Echo $ result [1];
$result = ltrim('YES_5e286f3e','YES_');echo $result;
?? You can.
$ Url = "http://www.123456.com/Ajax.ashx? Action = AddOrder & OrderIDShow = 1 & id = 10086 & Amt = 10 & Mb = 2 & Email = fdhfdf@qq.com "; $ result = file_get_contents ($ url ); $ result = str_replace ('yes _ ', '', $ result); // replace" YES ?? Empty echo $ result;
Replace 'yes _ 'with null.
Reference function: str_replace ();
Although you have found a solution, thank you!