Solved

CURL, Client URL Library Functions-  Problem with URL

Posted on 2006-11-30
3
188 Views
Last Modified: 2008-03-17
I use simple CURL code:

in main.php page:
<?php
$c=curl_init();

curl_setopt ($c, CURLOPT_URL, "loadsite.php");
curl_setopt ($c, CURLOPT_REFERER, "referersite");
curl_exec ($c);
curl_close ($c);

?>

When the loadsite.php uses CSS defined in an extern file ( <link rel=StyleSheet href="css/style.css" type="text/css" media=screen>
), then the extern file is not loaded because the URL of the page in the browser is main.php and NOT loadsite.php.

How can I solve this problem?
0
Comment
Question by:jodavid
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 250 total points
ID: 18044380
You could always use an preg_replace to replace all links with their full alternatives ie http://<site>/page.css

CURL will only pull one page at a time the only way you would be able to do it is rewrite the urld to css and images so they point at the ones on the original location or search for CSS links and then issue a seprate CURL to pull the style sheet and insert the source of that stylesheet inline into the page.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now