PHP remote call problem! Hope you can help me learn how to do it!

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.