4

How do I put the URL in the table and find a corresponding string in the table?

 2 years ago
source link: https://www.codesd.com/item/how-do-i-put-the-url-in-the-table-and-find-a-corresponding-string-in-the-table.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How do I put the URL in the table and find a corresponding string in the table?

advertisements

I am trying to search through a URL for a matching string, but the below code snippet doesn't seem to work.

<?php

$url = "http://www.drudgereport.com";

$search = "a";
$file = file($url);

if (in_array($search,$file)) {
    echo "Success!";
} else {
    echo "Can't find word.";
}

?>


If you are just searching for an occurrence of a string on the page, you can use

$str = file_get_contents($url);
if (strpos($str, $search) !== false) {
    echo 'Success!';
} else {
    echo 'Fail';
}

Related Articles

How do I put the title of the Google Superscript chart?

I have the next code var title = 'hello<sup>2</sup>'; Now I'm using google charts and I want the 2 appear as a superscript. I get hello<sup>2</sup> the code on the title is <text text-anchor="start" x="148" y

how can i put the command & ldquo; commands & rdquo; inside gdbinit?

How do I put the command "commands break#" inside .gdbinit? I tried this but failed. Thank you define macro1 b func1 commands p func1_var end # gdb complaints that "This command cannot be used at the top level." end This works fine for

How can we put the press effect on the anchor tag using css for 7

How I can put press effect on anchor tag. This is my css & html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org

How do you put the dynamic content into an object line of the sender of shares?

I'm trying to put the name of my app in the subject line of emails that action mailer sends. I have no problem doing this with the default from email address, but when I try to add it to the subject it sends it through as plain text <%= app_name %>.

How do I put the JavaScript code compiled into my HTML page?

Can anyone tell me how/where to put this code in a basic html page: var autoSizeText; autoSizeText = function() { var el, elements, _i, _len, _results; elements = $('.resize'); console.log(elements); if (elements.length < 0) { return; } _results = []

How can I put the PostgreSQL / bin directory on my path in Windows?

I've got a fairly simple question I guess. I'm working on a Ruby on Rails app. I'm trying to switch to PostgreSQL thanks to Heroku. In my database.yml file it states: Install PostgreSQL and put its /bin directory on your path. My question is how do I

How do I put the properties of the object as a table header?

I have one table,In which i want to put the table header name dynamically. component.html ` <table class="table"> <thead> <tr> <th>NAME</th> </tr> </thead> <tbody> <tr *ngFor="let speak of

How do I put the notification icon in the notification area while the app is running Android?

I want to place my app icon in notification area while my app is running. I searched a lot and made this possible, to show it in the notification area. public class MainActivity extends ActionBarActivity { NotificationManager mNotificationManager; @O

How can I put the image on the web page using Free Markup Template Language (FTL)?

I am interested to know how can we put image using FTL (Free Markup Template Language) ? Also how to change font color & style in FTL? Can any1 knows any good learning tutorial of FTL? plz share the link...FTL just generates text on the server, like

How do I put the result of Ajax (get server data) in the input tag?

See my picture: I want that result be filled into an input tag. It works if I do like this: <?php include('c2gcon.php'); include('logincheckadmin.php'); $nameajax=isset($_REQUEST['nameajax'])?$_REQUEST['nameajax']:null; if($nameajax<>null){ $user

How do I put a bean object into sessionMap and then retrieve its properties on the jsp page using the Struts 2 property tag

In login Action I am checking user authentication, and if it is validated, I am putting the user bean into sessionMap: public String execute() { if(userValid) sessionMap.put("userBean", userBean); //userBean retrieved from DB } Now on the landin

How do I put the WebBrowser control in IE9 into standards?

i am using automation (i.e. COM automation) to display some HTML in Internet Explorer (9): ie = CoInternetExplorer.Create; ie.Navigate2("about:blank"); webDocument = ie.Document; webDocument.Write(szSourceHTML); webDocument.Close(); ie.Visible =

How can I put the logo of my website as an icon image in the browser tabs?

The image next to the page title in the browser tab - how can you link an image here?That image is called 'favicon' and it's a small square shaped .ico file, which is the standard file type for favicons. You could use .png or .gif too, but you should

How can I put the three points showing on which page you are on my views?

I have UIViewControler with three views and UISwipeGestureRecogniser and I can't figure out how to put the dots that indicate on what page you are (like on the home screen on iOS.)You are looking for the UIPageControl. Just so you know, you have to u

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK