473,385 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Doubts in PhP Curl Functions

46
Hello sir,
Using Curl Function in PhP, i got the source of a Web page .
In that I did not want the entire content, like some contents are all not needed so i have to eliminate those contents from the web page source and then remaining things only needed...

Is it possible in PhP by using Curl Function. If possible means how???

Please reply......
Nov 22 '06 #1
6 1500
Unless the page needs authentication you can just use file_get_contents.

I don't know of a direct way other than seperating the source as a string
[PHP]
$start = strpos($str, "start of string you want",) ;
$end = strpos($str, "end of string you want", $start) + strlen("end of string you want");
$length = $end - $start;
$wantedCode = substr($str, $start, $length);
[/PHP]

It's a little crude, but works.
Nov 22 '06 #2
ronverdonk
4,258 Expert 4TB
I still wonder why you would have doubts about the cURL functions, seeing your thread title Doubts in PhP Curl Functions ? It gives you just what you asked! What you want to do with the result is your choice, but you cannot blame cURL for that.

Ronald :cool:
Nov 23 '06 #3
Velhari
46
I still wonder why you would have doubts about the cURL functions, seeing your thread title Doubts in PhP Curl Functions ? It gives you just what you asked! What you want to do with the result is your choice, but you cannot blame cURL for that.

Ronald :cool:
Sir,
I asked for that query is because of,
i did the program using Curl Function to get the page which is returned by google for any search string....... I want to show the resulted contents only... Not google related things means, In google search results displayed in window with the Sponsored links, Bottom having Navigation bar containing Paging No's and then Top having search Text box and etc., So these are all not needed for me..... Only the results of Search String only needed......

So for that only i asked that query, is it possible in Curl function to obtain specific contents from the entire source.

Plese reply me......
Nov 23 '06 #4
cURL is used for getting the entire response, cURL cannot give you any more or any less, except a success/fail reading, but from that mass of information you can use PHP to take the parts you want.
Nov 23 '06 #5
Velhari
46
cURL is used for getting the entire response, cURL cannot give you any more or any less, except a success/fail reading, but from that mass of information you can use PHP to take the parts you want.
Ok thanks sir,

I need another help from you sir, If i using preg_match to match for particular pattern in the string, It returns whether it is present or not..... But i want to get the Position of Occurrence of that pattern in that string.. Is it possible means tell me asap
Nov 23 '06 #6
ronverdonk
4,258 Expert 4TB
You opened a new thread for this last question, so now you start double posting!!

This thread will be closed.

Ronald :cool:
Nov 23 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: GluedToTheScreen | last post by:
I have a small PHP ecommerce site set up using Authorize.net's SIM (simple) interface. Working fine, but... I'd like to implement their AIM interface (so visitor's will never see the gateway's...
0
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its...
3
by: James | last post by:
Hi guys, I have been building a search engine here - not because I have plans of dethrowning Google but as a simple app upon which to develop a function set that I can use for other things. ...
7
by: lawrence k | last post by:
I'm reading over this page: http://www.php.net/manual/en/ref.curl.php What I'm missing is why? What problem does curl solve? What does it make easier? When would I use its functions, instead...
4
by: sundar22in | last post by:
Hi, How to use CUrl??? What are the libraries to be included using the require_once command?? I wanted to implement Range Header and get a part of file thru HTTP. So found that curl_setopt()...
7
by: h.stroph | last post by:
Greetings, I apologize for my lack of literacy with php, but am wondering if someone will tell me how to use the curl php functions to navigate to the page that results from entering the login...
1
kvijayhari
by: kvijayhari | last post by:
hi I've decided to use curl() to fetch the links from a website page from my server. If the page any harmful executable files, will my server execute that when i'm using the curl() function?...
1
by: jeddiki | last post by:
Hi, I am modifying a ipn script for my use and want to fully understand what it is doing. It seems to me that it is trying to do a cUrl and if that fails it uses a fsockopen function. Here are...
3
by: jeddiki | last post by:
I am using curl to down load a zip file and I am then trying to unzip it, but I don't think that I am using the functions properly because I get warnings This is my code: <?php if...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.